Advertisement
lewislovesgames

FrameSplit

Jul 13th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local tArgs = { ... }
  2. local f
  3. local framename
  4. if #tArgs == 0 or tArgs[ 1 ] == nil then error( shell.getRunningProgram() .. " <file> [prefix]", 0 ) end
  5. f = tArgs[ 1 ]
  6. framename = tArgs[ 2 ] or "/"
  7. --[[write( "Enter the location of the animation: " )
  8. old code
  9. local f = read()
  10.  
  11. write( "Prefix for files: " )
  12.  
  13. local framename = read()
  14. ]]--
  15.  
  16. print( "Writing files. Please wait... (Huge animations may take a while)" )
  17.  
  18. local curFrame = 1
  19. local output = fs.open(framename..curFrame, "w")
  20.  
  21. for line in io.lines(f) do
  22.   if line == "~" then
  23.     curFrame = curFrame + 1
  24.     output.close()
  25.     output = fs.open(framename..curFrame, "w")
  26.   else
  27.     output.writeLine(line)
  28.   end
  29. end
  30.  
  31. output.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement