Home   Help Search Login Register  

Author Topic: detecting non-defined variables  (Read 824 times)

0 Members and 1 Guest are viewing this topic.

duckwilliamson

  • Guest
detecting non-defined variables
« on: 26 Sep 2003, 22:01:25 »
how do you detect if a variable is undefined??

i haven't defined variable 'a'
can i make this so:

? a == -something- : do this

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:detecting non-defined variables
« Reply #1 on: 26 Sep 2003, 22:34:58 »
Here is one way...


Code: [Select]
?format["%1",_variabletocheck] == " scalar bool array string 0xfcffffef": hint "This variable doesn't exist!"
Edit: If "_Variabletocheck" is undefined, the hint will display. You can take this line and check any variable just by replacing "_variabletocheck".
« Last Edit: 26 Sep 2003, 22:37:13 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

duckwilliamson

  • Guest
Re:detecting non-defined variables
« Reply #2 on: 27 Sep 2003, 09:08:27 »
thanks toadlife ...

i knew it was something simple and you gave me a quick easy answer ...

thanks a lot!