9/26/08

nil value

Description


A nil value means nothing. None. Null. Blank. void. But NOT zero.

For example, if you are not targeting a unit and you execute a macro with UnitHealth("target"), then it will return nil.

Any usage, of undeclared variables as parameters will cause error and the whole script will not run.
nil is not called with quote wrap. It is used like a variable(without wraps)

If you use functions that will return nil in if then else end statements, it will return nil and perform the else functions instead.

For example, if you don't have a target and you use this:

/run local x if UnitExists("target") then x="You have a target!" else x="You don't have a target" end message(x)


Because the UnitExists("target") will return nil,it will say "You don't have a target".

But if you have a target, function UnitExists("target") will return 1. Yeah as in ONE. When this is returned, then it will put to local variable x "You have a target!".