lua-users home
lua-l archive

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


I have a suggestion for an addition to Lua.

I frequently have programs that need to add an entry to a table
that is acting as an array.

where tab = {}
my options currently are:

1)  maintain an last inserted index and use tab[nextix] = myvalue
or
2) use table.insert as table.insert(tab, myvalue)

methinks it would be worthwile to have native language support for
this operation

e.g.

tab = {}
tab += myvalue
tab .. myvalue
tab := myvalue

I am not sure of the operator and I am open to suggestions. I guess I am
just looking for a syntactically easier way to write a very common (for me)
operation.

DB