-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
26 lines (25 loc) · 798 Bytes
/
init.lua
File metadata and controls
26 lines (25 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
do
local addr, invoke = computer.getBootAddress(), component.invoke
local function loadfile(file)
local handle = assert(invoke(addr, "open", file))
local buffer = ""
repeat
local data = invoke(addr, "read", handle, math.huge)
buffer = buffer .. (data or "")
until not data
invoke(addr, "close", handle)
return load(buffer, "=" .. file, "bt", _G)
end
loadfile("/lib/core/boot.lua")(loadfile)
end
while true do
local result, reason = xpcall(require("shell").getShell(), function(msg)
return tostring(msg).."\n"..debug.traceback()
end)
if not result then
io.stderr:write((reason ~= nil and tostring(reason) or "unknown error") .. "\n")
io.write("Press any key to continue.\n")
os.sleep(0.5)
require("event").pull("key")
end
end