Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local term = require("term")
- local code = {}
- local fileName = ""
- local extension = ""
- local cntr = 1
- local inputFile = {}
- local outputFile = ""
- local serial = require("serialization")
- local fs = require("filesystem")
- term.clear()
- term.write("Filename?")
- term.setCursor(1,2)
- fileName = io.read()
- term.setCursor(1,3)
- term.write("Extension?")
- term.setCursor(1,4)
- extension = io.read()
- local inputFileName = fileName .. extension
- outputFile = fileName .. ".serial"
- file = io.open(inputFileName, "r")
- local size = fs.size(inputFileName)
- inputFile = file:read(size)
- term.setCursor(1,5)
- term.write("Converting file")
- term.setCursor(1,6)
- term.write(inputFile)
- local token = ""
- repeat
- fileString = term.write(inputFile[cntr])
- cntr = cntr + 1
- until (inputFile[cntr] = nil)
- -- 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