lua-users home
lua-l archive

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


On Wednesday, March 04, 2015 01:21:46 PM Soni L. wrote:
> The string metatable has __index which is an empty sequence.

debug.setmetatable(nil, {__index=function() return nil end})
for _ in ipairs(nil) do end -- no error

ipairs returns different iterators depending on whether there is an __index 
metamethod. One side effect is you can't use the same iterator with different 
types. Not that any reasonable person would want to do that.

-- 
tom <telliamed@whoopdedo.org>