[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Undefined variables returning nil
- From: Coda Highland <chighland@...>
- Date: Tue, 19 Mar 2013 19:01:55 -0700
On Tue, Mar 19, 2013 at 5:49 PM, Petite Abeille
<petite.abeille@gmail.com> wrote:
>
> On Mar 20, 2013, at 1:00 AM, Ivo Beltchev <ivo@ibeltchev.com> wrote:
>
>> because there is no way to distinguish between "not defined" and "defined, but currently nil":
>
> Sure you can. Keep track of your key assignments with __newindex and call it a day. Tables are building blocks. Feel free to build something with them.
>
>
Alternatively, define a global "null = {}" since tables only have
reference equality (that is, assert(null ~= {}) in this case) and use
that when you want to explicitly say "defined but valueless."
/s/ Adam
- References:
- Undefined variables returning nil, William Sumner
- Re: Undefined variables returning nil, Petite Abeille
- Re: Undefined variables returning nil, William Sumner
- Re: Undefined variables returning nil, Kaj Eijlers
- Re: Undefined variables returning nil, William Sumner
- Re: Undefined variables returning nil, Petite Abeille
- Re: Undefined variables returning nil, William Sumner
- Re: Undefined variables returning nil, Kevin Martin
- Re: Undefined variables returning nil, William Sumner
- Re: Undefined variables returning nil, Kevin Martin
- RE: Undefined variables returning nil, Ivo Beltchev
- Re: Undefined variables returning nil, Petite Abeille