Guest User

convert.lua

a guest
Mar 14th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local io = require("io")
  4.  
  5. local file = io.open(args[1],"r")
  6. local fo = io.open("/home/obj", "wb")
  7. if not file then
  8.   error("No file")
  9. end
  10.  
  11. local str = file:read(2)
  12. while str do
  13.   print(str)
  14.   if file:read(1)== "\r" then file:read(1) end
  15.   fo:write(string.char(tonumber(str, 16)))
  16.   str = file:read(2)
  17. --  os.sleep(1)
  18. end
  19.  
  20. --fo:write(string.char(0x00))
  21. --fo:write(string.char(0x00))
  22. --fo:write(string.char(0xf0))
  23. --fo:write(string.char(0xff))
  24.  
  25. fo:close()
  26. file:close()
Add Comment
Please, Sign In to add comment