Code: Select all
test = io.stdin:read()
I'm trying to read all stdin that comes in!
Code: Select all
test = io.stdin:read()
Code: Select all
var spawn = require('child_process').spawn,
ls = spawn('/Users/Ryan/Documents/Love/Versions/64/0.9.1/love.exe', ['/Users/Ryan/Documents/Love/Projects/Game1']);
ls.stdout.on('data', function (data) {
console.log('' + data);
ls.stdin.write("test");
});
ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
ls.on('close', function (code) {
console.log('child process exited with code ' + code);
});
Code: Select all
function love.load()
--Don't Edit--
io.stdout:setvbuf("no")
--io.stdin:setvbuf("no")
--Don't Edit--
love.graphics.setBackgroundColor(255, 255, 255);
minecraftFont = love.graphics.newFont("Minecraftia2.ttf", 16 )
io.stdout:write("hello")
test = io.stdin:read()
end
function love.update(dt)
end
function love.draw()
love.graphics.setColor(0, 0, 0, 255)
love.graphics.setFont(minecraftFont)
love.graphics.print("FPS: "..tostring(love.timer.getFPS( )), 0, -12)
end
Code: Select all
ls.stdin.write("test");
Code: Select all
ls.stdin.write("test");
ls.stdin.close();
Code: Select all
ls.stdin.write("test\n");
Code: Select all
function love.update(dt)
test = io.read("*line")
end
Code: Select all
dst = io.open( filename, 'w' ) -- or 'a'
for i = 1, #lines do
dst:write( lines[i]..'\n' )
end
dst:close( )
src = io.open( filename, 'r' )
read = {}
repeat
local line = src:read( '*l' )
if line then read[ #read+1 ] = line end
until line == nil
src:close()
Code: Select all
function love.load()
--Don't Edit--
io.stdout:setvbuf("no")
--Don't Edit--
thread = love.thread.newThread("node.lua")
node = love.thread.getChannel("node")
thread:start()
--sends data to node.js process
io.stdout:write("hello")
test = "none"
end
function love.update(dt)
v = node:pop()
if v ~= nil then
test = v
end
end
function love.draw()
love.graphics.print(test), 0,0)
end
Code: Select all
nodeGet = love.thread.getChannel("node")
repeat
local s = io.read("*line")
nodeGet:push(s)
until s == "quit"
Code: Select all
var spawn = require('child_process').spawn,
ls = spawn('/Path/to/love.exe', ['/Path/to/Love/Project/Folder/or/.love/File']);
ls.stdout.on('data', function (data) {
console.log('' + data);
});
ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
ls.on('close', function (code) {
console.log('child process exited with code ' + code);
});
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 5 guests