Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This script must be used with other one, not on pastebin
- function readAll(file)
- local f = fs.open(file, "r")
- local content
- if not f then
- print("Can't open ", file)
- return false
- end
- content = f.readAll()
- f.close()
- return content
- end
- function writeAll(file, str)
- local f = fs.open(file, "wb")
- if not f then
- print("Can't open ", file)
- return false
- end
- for val in str:gmatch".." do
- print(val)
- f.write(tonumber(val, 16))
- end
- f.close()
- return true
- end
- local arg = {...}
- if not arg or not arg[1] or not arg[2] then
- print("pastebinToFile [file to convert] [output file]")
- else
- local pasted = readAll(arg[1])
- if pasted then
- writeAll(arg[2], pasted)
- print("Done !")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement