lua-users home
lua-l archive

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


One more little question about the self-iterating patch.  I found this line in the patch notes:
 
This will break some subtle code tricks such as using the __call event to "fake" self-iteration.

This certainly sounds like something all patch users should keep in mind, but I don't understand what sorts of "subtle tricks" are being referenced. 

Even with the patch enabled, it appears that you can still use __call as an iterator function.  For example, this still works:

for k,v in setmetatable({},{__call=function() return pairs({3,2,1}) end})() do
   print(k,v)
end

And that's about as dangerous a trick as I can think of.  What sorts of patterns does the patch break?

-Sven