[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: a lua_len that give return, not a new value on stack?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 22 Nov 2013 20:52:58 +0200
2013/11/22 Andrew Starks <email@example.com>:
> I've looked around for this and can't find it. It's not a big deal,
> but I find myself wanting to do
> t[#t + 1] = v
> and in C, that's actually a lot of code.
That's because quite a lot happens. The `#` operator may trigger
a metamethod, a new table entry must be created, etc.
I would write a macro so that all the ugliness goes in there and
my code would simply say
Don't tell me you are too puristic for this. Many of the API functions
are actually implemented as macros.