[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: sunday afternoon whishlist
- From: Gavin Wraith <gavin@...>
- Date: Sun, 09 May 2010 17:16:30 +0100
> Could x[] be syntactic sugar for x[#x+1] ?
> It would make appending to lists so much nicer.
I usually avoid much of this notation by initializing x with
a 'push' method:
do
local push = function(self,item) self[1+#self] = item end
local x = { push = push }
....
x:push(expr)
...
end
I suppose it is a bit slower.
--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/