Advertisement
Asioron

init

Sep 26th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. do
  2.   local loadfile = load([[return function(file)
  3.     local pc,cp = computer or package.loaded.computer, component or package.loaded.component
  4.     local addr, invoke = pc.getBootAddress(), cp.invoke
  5.     local handle, reason = invoke(addr, "open", file)
  6.     assert(handle, reason)
  7.     local buffer = ""
  8.     repeat
  9.       local data, reason = invoke(addr, "read", handle, math.huge)
  10.       assert(data or not reason, reason)
  11.       buffer = buffer .. (data or "")
  12.     until not data
  13.     invoke(addr, "close", handle)
  14.     return load(buffer, "=" .. file, "bt", _G)
  15.   end]], "=loadfile", "bt", _G)()
  16.   loadfile("/lib/core/boot.lua")(loadfile)
  17. end
  18.  
  19. os.execute('/autorun.lua')
  20.  
  21. while true do
  22.   local result, reason = xpcall(require("shell").getShell(), function(msg)
  23.     return tostring(msg).."\n"..debug.traceback()
  24.   end)
  25.   if not result then
  26.     io.stderr:write((reason ~= nil and tostring(reason) or "unknown error") .. "\n")
  27.     io.write("Press any key to continue.\n")
  28.     os.sleep(0.5)
  29.     require("event").pull("key")
  30.   end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement