lua-users home
lua-l archive

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


On Mon, 10 May 2010 10:51:05 -0600
HyperHacker <hyperhacker@gmail.com> wrote:

> > Can anyone come up with any issues?
> >
> > Daurn.
> >  
> 
> An obvious one I see is what happens when you do this?
> t = {}
> t[1,2] = 42
> t[1,2] = 27
> On line 2 it's going to pass two parameters to __index, but on line
> three, unless a __usedindex or some such method is added (which I
> highly support and have already patched into my own copy), where do
> the multiple parameters go?

Since a table is a single-dimension thing, as I see it, the third line should also call __index (even if there is already something at eg t[1*rowsize+2]). I mean the multiple-index semantics are app-specific, implemented in __index; & Lua is not supposed to interpret it, thus for the language t[i,j,...] always fails and __index gets called. But maybe I don't properly get the intent of the proposal.

Denis
________________________________

vit esse estrany ☣

spir.wikidot.com