Pharap, I don't think that's what I need, I'm looking to recognize the number in the message. So like said above:
Broadcast = 6, Hello Everyone
The computer receiving would copy that message to be sent again but depending on the number in front of the actual message
it would open/close a rednet port. So basicly, it would if x == 1 then, if x == 2 then, if x == 3 then…. "x" being the number 6 from the broadcast.
I am completely clueless
I know what you are trying to do.
All you need to to is choose a delimiter to separate the message from the number (eg ";")
Then run the script like this:
e, id, msg = os.pullevent
if e == "rednet_message" then
local pos = string.find(msg, ";")
local NtoTest = tonumber(string.sub(msg,1,pos-1)
local RelayMsg = string.sub(msg, pos+1)
--other stuff goes here
end
NtoTest is the number you want, RelayMsg is the message without the number and the delimiter so you can pass it on.
There, I did know what you wanted, I was just foolishly assuming you knew how to extract the number from the string.