BombBloke

decodeSTA.lua

Jan 21st, 2021
530
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -------------------
  2. -- decodeSTA.lua --
  3. -------------------
  4.  
  5. -- For some game, I don't even know what it is lol.
  6.  
  7. -- Run this within a folder with some STA files in it.
  8. -- TXT file conversions will be created in the same folder.
  9. -- Pre-existing TXT files will be replaced without prompting.
  10.  
  11. require "lfs"
  12.  
  13. for entry in lfs.dir(lfs.currentdir()) do if entry:sub(-4):lower() == ".sta" then
  14.     local input = io.open(entry, "rb")
  15.     local output = io.open(entry:sub(1, #entry - 3) .. "txt", "w")
  16.     local strCount = 0
  17.    
  18.     input:read(16) -- header crap, skip for now
  19.    
  20.     while true do
  21.         local long = input:read(4)
  22.         if not long then break end
  23.         output:write("\n*Do*Not*Edit*This*Line* " .. strCount .. "\n" .. input:read(long:byte(1) * 256^3 + long:byte(2) * 256^2 + long:byte(3) * 256 + long:byte(4)))
  24.         strCount = strCount + 1
  25.     end
  26.    
  27.     input:close()
  28.     output:close()
  29. end end
RAW Paste Data