[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: nil-valued globals
- From: Björn De Meyer <bjorn.demeyer@...>
- Date: Wed, 05 Feb 2003 22:38:46 +0100
"xenarcher " wrote:
>
> Is it possible to distinguish between an undefined global variable
> and one that is defined but has the value 'nil'? Or does assigning
> the value 'nil' to a global variable essentially undefine that global?
Yes, a variable that is set to nil is essentially undefined.
Setting a defined variable to nil will effectively erase it's value,
which will garbage collected at the next cycle.
In Lua 5, you can usually solve this problem by setting the
variable to false. In boolean expressions, false and nil are
equivalent, but false values are stored in variables, and are
thus distinguishable from nil values.
--
"No one knows true heroes, for they speak not of their greatness." --
Daniel Remar.
Björn De Meyer
bjorn.demeyer@pandora.be
- References:
- nil-valued globals, xenarcher <nickl@<a href="/cgi-bin/echo.cgi?volition-inc.com">...</a>>