lua-users home
lua-l archive

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


-----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