The framesplit program is Pastebin ID: 5jkpZRj6
The test.nfa is Pastebin ID: KneqXszu
Please help!
I know the ending of a frame is the ~ character. It splits up the first frame fine, but 2 and 3 are completely blank.
Thanks!
for x = startf, endf do
if f.readLine( x ) == endchar then --#if this line is equal to the end character
frameend = true --#end the loop
lineend = x
else --#else
framebuffer[ x ] = f.readLine( x ) .. "\n" --#add the NEXT line to the file
--print( framebuffer[ x ] )
end
end
framebuffer[ x ] = f.readLine( x ) .. "\n" --#add the NEXT line to the file
--#is this line the end character?
7777777 --#no, lets save this line to the table
7 7777 --#is this line the end character?
77777777 77 77 --#no, lets save this line to the table
777777777777 7 --#is this line the end character?
777 77777777 77 --#no, lets save this line to the table.
77 7777777777
7 777
7 777
7 77
777 7
77 77
7777 777
77777 77777
~
7
777 7777777
777 7 7777
777777777 77 77
777777777777 7
777 77777777 77
77 777777777777
7 77 777
7 77 777
7 77
777 7
77 77
7777 777
77777 77777
~
7
777 7777777
777 7 7777
777777777 77 77
777777777777 7
777 77777777 77
77 777777777777
7 77 777
7 77 777 77
7 77 777
777 7777777
77 777777777777
7777 77 777
777777777777777777777 77777 77777
if f.readLine( x ) == endchar then
frameend = true
lineend = x
else --#ELSE
framebuffer[ x ] = f.readLine( x ) .. "\n"
--print( framebuffer[ x ] )
end
write( "Enter the location of the animation: " )
local f = read()
write( "Prefix for files: " )
lcoal framename = read()
print( "Writing files. Please wait..." )
local curFrame = 1
local output = fs.open(framename..curFrame, "w")
for line in io.lines(f) do
if line == "~" then
curFrame = curFrame + 1
output.close()
output = fs.open(framename..curFrame, "w")
else
output.writeLine(line)
end
end
output.close()