Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local term = require("term")
- local code = {}
- local cntr = 1
- local serial = require("serialization")
- local fs = require("filesystem")
- term.clear()
- term.write("Filename?")
- term.setCursor(1,2)
- local fileName = io.read()
- term.setCursor(1,3)
- term.write("Extension?")
- term.setCursor(1,4)
- local extension = io.read()
- local inputFileName = fileName .. extension
- local outputFile = fileName .. ".serial"
- local file = assert(fs.open(inputFileName, "r"))
- local size = fs.size(inputFileName)
- inputFile = file:read(size)
- term.setCursor(1,5)
- term.write("Converting file")
- term.setCursor(1,6)
- local token = ""
- for token in string.gmatch(inputFile, "[^%s]+") do
- code[cntr] = token
- cntr = cntr + 1
- end
- output = io.open(outputFile, "w")
- output:write(serial.serialize(code))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement