Re: Writing binary to a socket..
Posted: Tue Oct 15, 2013 9:15 pm
Haha, oh. I was under the impression the argument was in milliseconds.
I looked at some LUBE code I had laying around, and that in conjunction with your help (Boolsheet), I can send and receive data now.
Brings me to my next question .
What's the best way to make a drawable image from a string (from ImageData:getString() ) ?
I would think there would be a Image:fromString(string) or ImageData:fromString(string)..
When I try
I get a "could not decode image!" error from the
line.
I looked at some LUBE code I had laying around, and that in conjunction with your help (Boolsheet), I can send and receive data now.
Brings me to my next question .
What's the best way to make a drawable image from a string (from ImageData:getString() ) ?
I would think there would be a Image:fromString(string) or ImageData:fromString(string)..
When I try
Code: Select all
function recv(data)
if data:sub(-4) == 'done' then
s = s .. data:sub(1,-5)
local f = love.filesystem.newFile('imgFile.txt')
f:open('w')
f:write(s)
f:close()
local imgData = love.image.newImageData('imgFile.txt')
lastImage = love.graphics.newImage(imgData)
lastReceived = os.time()
s = ''
else
s = s .. data
end
end
Code: Select all
local imgData = love.image.newImageData('imgFile.txt')