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<1)then error("Need one argument",0) end
- if(not fs.exists(args[1]))then error("Invalid filename",0) end
- --Functionality--
- local function loadfile(inFile)
- local data = {}
- local file = fs.open(inFile,"rb")
- local clock = os.clock() + 4.5
- for i = 1,fs.getSize(inFile)do
- data[i] = string.char(file.read())
- 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()
- return loadstring(table.concat(data))
- end
- loadfile(args[1])(select(2,unpack(args)))
Advertisement
Add Comment
Please, Sign In to add comment