[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Index with multiple parameters?
- From: Chris <coderight@...>
- Date: Tue, 19 Feb 2008 16:55:08 -0500
How hard would it be to modify the parser so that the index and
newindex metamethods could have multiple parameters?
Usage would be something like:
foo[1, 2, 3] = 4
I suppose in the case of newindex it would make sense to pass the
value it's setting in the same position with extra parameters
trailing. Ideally it would be earilier but for compatibility it would
have to be similar to the old method.
function foo.__newindex(obj, idx1, value, idx2, idx3 ...)
I realize it's possible to just pass a table but this has performance
problems for me compared to regular indexing. Actually I'm not sure
what kind of performance penalty this multiple parameter indexing
might have but I wouldn't think it would be any worse than a function