Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --if not os.getComputerLabel() then
- -- local label = "casavanet_" .. tostring(math.random(1000000, 999999))
- -- os.setComputerLabel(label)
- -- print("Set label to", label)
- --end
- print("CasavaNet 1.0")
- local modem = peripheral.find("modem")
- modem.open(9191)
- local cordinate = nil
- local w, h = term.getSize()
- local running = false
- while true do
- local e = {os.pullEvent()}
- if e[1] == "modem_message" then
- local msg = e[5]
- if msg.type == "shutdown" then
- print("Shutting down...")
- sleep(0.5)
- os.shutdown()
- elseif msg.type == "start" then
- running = true
- print("Starting new program")
- local function run()
- print("Running", table.unpack(msg.content))
- shell.run(table.unpack(msg.content))
- end
- cor = coroutine.create(run)
- win = window.create(term.native(), 1, 1, w, h)
- elseif msg.type == "end" then
- running = false
- print("Ending program")
- cor = nil
- win = nil
- elseif msg.type == "event" and running and cor and window then
- local data = msg.content
- term.redirect(win)
- coroutine.resume(cor, unpack(data))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement