[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Any pitfalls to the nil index idiom?
- From: "Thomas Jericke" <tjericke@...>
- Date: Tue, 19 Jul 2016 08:15:39 +0200
-----Original Message-----
> From: "Dirk Laurie" <[email protected]>
> To: "Lua mailing list" <[email protected]>
> Date: 18-07-2016 18:26
> Subject: Re: Any pitfalls to the nil index idiom?
>
> 2016-07-18 18:20 GMT+02:00 Roberto Ierusalimschy <[email protected]>:
> >> debug.setmetatable(nil,{__index = load''})
> > ??????
>
> load'' (that's two single quotes, not one double quote) is equivalent to
> function(...) return end
Interesting, but out of curiosity. Wouldn't
debug.setmetatable(nil,{__index = {}})
be faster and arguably simpler?
--
Thomas