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

[Question][Lua] Detecting a nil value (SOLVED)

Started by Saugrim, 16 October 2012 - 02:45 AM
Saugrim #1
Posted 16 October 2012 - 04:45 AM
EDIT: Code works fine, it was actually because I was trying to update from the server, and since the server was down it returned an error, I apologize.


Well, I have been attempting to make it so that my browser can detect when a
rednet.receive()
has reached 0 on the timeout, since it says that the message, and ID will both be returned as nil when the timeout is reached..

Anyways this is my attempt that I made at first, and well of course if I am here it clearly didn't work out to well xD.


rednet.send(26, url)
ID, message = rednet.receive(2)

var0 = nil

if message == var0  then
print("Server didn't respond!")

Any help would be appreciated, thanks. :3
Doyle3694 #2
Posted 16 October 2012 - 07:09 AM
actually, you don't need that variable.

if message == nil  then
is actually correct too. you forgot to end your if though. :D/>/>