lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Feb 28, 2013 at 8:20 PM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Thu, Feb 28, 2013 at 6:47 PM, Sven Olsen <sven2718@gmail.com> wrote:
>> By chaining ~, I can write statements like the following, which are safe
>> even when 'object' or any of it's subtables have a chance of being nil:
>>
>>   color = object~icon~glow~color or white
>
> you can change the metatable of nil to get that behavior.
>
>
> --
> Javier
>

You could also use a unique userdata and assign a metatable to that.

/s/ Adam