[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why don't pairs() and ipairs() obey an __index metamethod?
- From: gary ng <garyng2000@...>
- Date: Wed, 19 Sep 2007 23:02:26 -0700 (PDT)
My guess is efficiency for ipairs().
And I don't know what would be the meaning of pairs()
on an non-array type table with metatable.__index .
query everything in the object table itself then the
table of metatable.__index ? But __index doesn't need
to be a table and can be a function then what would it
mean ? It is ok to pass it just an integer(as in
ipairs with __index support) but how to cover the hash
part ? Anything can be a key for a hash and I cannot
think of a way to generate this key value to __index
So pairs() with __index support is kind of useless.
That left us with ipairs(), why would I want an
__index backed array ?
The only thing I can think of is some form of
overlay(copy on write?) an array over another one.
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!