[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: C coding practice for top of stack
- From: Kevin Martin <kev82@...>
- Date: Thu, 21 Feb 2013 19:54:56 +0000
On 21 Feb 2013, at 19:40, Marc Lepage wrote:
> Is that a good idea in cases like this? Or would the extra settop not be worth the effort?
If I am writing a function which should be called with n params, the first thing I do is lua_settop(l, n). That way I don't have to worry if any params have been missed, as they'll now be on the stack with a nil value, I only have to check their type.
Don't know if it's a good idea, but it's what I always do, Iand so far 've not found any problems.