Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component = require("component")
- event = require("event")
- computer = component.computer
- modem = component.modem
- maincomputer = 1ba372b4-beef-4307-bce6-1f99d89b4530
- modem.open(666)
- function unknownEvent()
- end
- local myEventHandlers = setmetatable({}, { __index = function() return unknownEvent end })
- -- Motion
- function myEventHandlers.motion(address, relX, relY, relZ, name)
- print(name,relX,relY,relZ)
- modem.send(maincomputer, 666, address, relX, relY, relZ, name)
- end
- --
- function myEventHandlers.touch()
- os.exit()
- end
- function handleEvent(pulledEvent, ...)
- if (pulledEvent) then
- myEventHandlers[pulledEvent](...)
- end
- end
- while true do
- handleEvent(event.pull())
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement