Posted 15 March 2017 - 03:09 PM
I have made an animation player that follows a specific format. I made the animation file and the syntax is correct but when I play it in the player nothing happens.
Please help!
Thanks!
Code
-- Animation Player
-- By: houseofkraft
local nPos = 1
local tArgs = { ... }
local function save( tTable, sFile )
local tHandle = fs.open( sFile, "w" )
for k,v in pairs(tmpImg) do
tHandle.writeLine(v)
end
tHandle.close()
end
if #tArgs < 1 then
printError("Usage: play <file>")
return
end
local tFile = fs.open( tArgs[1], "r" )
local isEnd = false
for i = 1, 1024 do
fs.delete(".tmp")
tmpImg = {}
for index, sLine in tFile.readLine do
if sLine == "NEXT" then
nPos = index + 1
break
elseif sLine == "END" then
isEnd = true
break
else
table.insert(tmpImg, sLine)
end
end
if isEnd then
break
end
save(tmpImg, ".tmp")
img = paintutils.loadImage( ".tmp" )
paintutils.drawImage( img, 1,1 )
os.sleep(0.1)
--end
end
Please help!
Thanks!