In some situations it would make sense to assign a table to __pairs/__ipairs -- similarly to how you can assign a table or function to __newindex/__index.
Usually if I'm using __pairs/__ipairs I'm working with proxy objects. I'm creating a ~class~ that constructs proxy objects and I'm defining those within the metatable like so:
__pairs = function (self) return pairs(real_tables[self]) end
__ipairs = function (self) return ipairs(real_tables[self]) end
The proxies are used to retrieve a reference to the table we're really iterating over, and we just call pairs()/ipairs() again. Using functions here is ideal -- rather than what I'm suggesting -- because the same 2 functions are referenced *once* through that shared metatable on all proxy objects and yet they point to and result in the iteration of their individual real_object tables using the the stock behavior of pairs()/ipairs(). To ...reiterate (haha)... the metatable is shared between all proxy objects. What I'm suggesting would allow you to create individual metatables for each with a __pairs and __ipairs pointed at real_tables[self]. This would result in more memory usage and is bad. BAD BAD BAD.
However, for people who aren't constructing many proxy objects and aren't worrying over memory, perhaps this convenience would be nice if you're defining individual objects:
__pairs = { 'a', 'b', 'c' }
__ipairs = { 'a', 'b', 'c' }
This is the same convenience provided by __index/__newindex -- though I imagine that was done for efficiency. It wouldn't make sense for the many-constructed-proxies situation unless they all acted like references to iterate over a shared table.
So I leave it to the community to decide:
1) Simple enough change to match the semantics of __newindex/__index?
2) Encourages more memory usage by how I explained above.
3) I'm missing something obvious that makes this a bad idea.
4) lfh should get all my presents this year
5) ???
6) This was explained already, search gmane.
The code to be modified would be pairsmeta() in lbaselib.c... it was only 4 lines and it works as expected :> (Can someone double-check?)