lua-users home
lua-l archive

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


On Sep 4, 2013, at 5:31 PM, Andrew Starks <andrew.starks@trms.com> wrote:

> One would not like to be caught redesigning Lua on this list! :)
> 
> if i did, then I'd say that it would be nice if "for" received a table after "in", it would look for the "__in" metamethod and call it with the table as the argument. 
> 
> It isn't a big deal though, wich is why I won't wish for it publicly
> 
> :)
> 
> -Andrew

Another example of the somewhat incomplete use of metamethods in Lua at present. However, remember that for "for … in ..." statement really expects three arguments, not one (we are just used to all three being the return values of a generator function such as pairs()). Not saying it can't be done, though.

--Tim