[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: why does tolua clear the stack?
- From: Ben Sunshine-Hill <bsunshin@...>
- Date: Tue, 26 Nov 2002 03:11:00 -0800
It's important to recognize that the "stack" that C functions called by Lua
see only contains the arguments to the function. Thus, once you've extracted
all the arguments into C variables, there's no need to keep the arguments on
the stack. Clearing the stack allows you to keep it as small as possible
(since otherwise you'd be adding the return values to it at the end). In most
cases, I think it wouldn't matter.
Ben
On Tuesday 26 November 2002 02:57 am, Asko Kauppi wrote:
> Tolua-generated code seems to call 'lua_settop(0)' in between reading the
> arguments and pushing the return values. Why is this? Could someone knowing
> the Lua internals comment on whether this is good, bad, or does not matter?
> Examples in Lua manual (5.0) don't do such a thing.