[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug in 5.3 ipairs(), or feature?
- From: Tom N Harris <telliamed@...>
- Date: Wed, 04 Mar 2015 14:44:03 -0500
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>