Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Choose rednet modem side
- local side = "back";
- -- Open Rednet
- rednet.open(side)
- -- Now create the main function
- local function main()
- local args = { os.pullEvent() }
- if args[1] == "rednet_message" then
- -- This is the senderid of the computer
- local senderid = args[2]
- -- This is the message
- local message = args[3]
- -- Pass the message to the action function
- action(message)
- -- Log messages
- print("Received: " .. tostring(senderid) .. " > " .. tostring(message))
- end
- end
- -- Now create the control function
- local function action(message)
- if (message == "lights") then
- -- Example turn out lights
- elseif (message == "") then
- -- Empty for you
- elseif (message == "") then
- -- Empty for you
- end
- end
- -- Run function
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement