This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
SNWLeader's profile picture

[Lua] Rednet message == ?

Started by SNWLeader, 03 February 2013 - 08:37 AM
SNWLeader #1
Posted 03 February 2013 - 09:37 AM
I am trying in hopes of making a creditcard system in my singleplayer so that I may transfer it over to a server when I get the chance.

I am trying to get the part about getting the rednet messages to trigger a action.

I wanted to know how to check if the rednet message is equal to a command and will preform a certain action.

What would I do for that?



Also I wanted to know when to detect, since my credit system will work by saving files for each user and encrypting them by multiplaying the balance by itself to encrypt it, how would I have it to detect when the user file is not existing to perform an action.
remiX #2
Posted 03 February 2013 - 09:47 AM

sID, msg = rednet.receive()

if msg == "Reboot" then
    os.reboot()
elseif msg == "Derp" then
    print("I derped!")
end