lua-users home
lua-l archive

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


On Sun, 9 May 2010 14:37:55 -0700
Jonathan Castello <twisolar@gmail.com> wrote:

> n regards to the "tbl[] = value" suggestion, I like it. My only
> problem is, what would tbl[] return in an __index context? "tbl[] =
> value" is obvious enough, but I'm not sure what "value = tbl[]" would
> do without being un-obvious.

In "t[]", "[]" could mean "at the end", which is an notion, not a value. Thus we can have

    t[] = x	-- put a the end (#t+1)
    x = t[x]    -- get at the end (#t)

But I prefere explicit t.put(x) and t.get(). Simply those should be builtin to avoid counting #.


Denis
________________________________

vit esse estrany ☣

spir.wikidot.com