ArchAngel075, on 06 December 2012 - 01:55 AM, said:
Looking at how I decompile the animation files, i noticed there will be a problem if it hits nil, since i use a '&&' to signal end of file where yours does not...
Any suggestion to detect the end of your files?
-edit-
I will just make it check if a '&&' exists, else toss one at the end before attempting to decompile for safety.
You can check the loadFromNFA method in NPaintPro to see precisely how I parse the file, but EOF is easy. You don't need a dedicated character, I just use:
local file = io.open("file")
local line = nil
repeat
line = file:read()
--Your parse code here
until not line
When line becomes nil you've reached the end of the file.