lua-users home
lua-l archive

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


-----Original Message----- 
> From: "Dirk Laurie" <dirk.laurie@gmail.com> 
> To: "Lua mailing list" <lua-l@lists.lua.org> 
> 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 <roberto@inf.puc-rio.br>:
> >>    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