Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----
- --Original compile and run source code developed by Pharap
- --http://www.computercraft.info/forums2/index.php?/user/3218-pharap/
- --
- --The original source can be found here:
- --Compile.lua: http://pastebin.com/S520NYMV
- --Run.lua: http://pastebin.com/xjBgXmfy
- ---
- --Argument Checking--
- local args = {...}
- if(#args<2)then error("Need two arguments",0) end
- if(not fs.exists(args[1]))then error("Invalid filename",0) end
- --Functionality--
- local function compile(inFile,outFile)
- local file = fs.open(inFile,"r")
- local dump = string.dump(loadstring(file.readAll()))
- file.close()
- file = fs.open(outFile,"wb")
- local clock = os.clock() + 4.5
- for i = 1,#dump do
- file.write(string.byte(dump:sub(i,i)))
- if(os.clock()>=clock)then
- os.queueEvent"" -- Prevents 5 second loop.
- coroutine.yield() -- Suggested by pingoleon60 and theoriginalbit
- clock = os.clock() + 4.5
- end
- end
- file.close()
- end
- compile(args[1],args[2])
Add Comment
Please, Sign In to add comment