[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Any pitfalls to the nil index idiom?
- From: Xavier Wang <weasley.wx@...>
- Date: Tue, 19 Jul 2016 18:14:30 +0800
2016-07-19 14:57 GMT+08:00 Oliver Kroth <oliver.kroth@nec-i.de>:
> Interesting, but out of curiosity. Wouldn't debug.setmetatable(nil,{__index
> = {}}) be faster and arguably simpler? -- Thomas
> I guess not. Lua would then try to look up the key in the empty {} table,
> and fail
>
But it will return a nil, and index a nil still return a nil, seems no problem.
> --
> Oliver
>
--
regards,
Xavier Wang.