lua-users home
lua-l archive

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


Ando's question brings to my mind a question that I couldn't find a clear
answer to in the docs:

When a C function is passed arguments (from Lua) on the stack, is it all
right for the function to reorder or pop these arguments from the stack so
that it can manipulate them more easily? Or, to phrase it another way: how
much of the stack would the function need to preserve in order to prevent
stack corruption?

Andrew

----- Original Message -----
From: "Peter Shook" <pshook@sympatico.ca>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Thursday, July 31, 2003 10:41 PM
Subject: [spam] Re: Stack state on call to C routine


>
> Ando Sonenblick wrote:
> > Is the stack top on entry to a C routine I've registered **guaranteed**
to
> > always indicate the number of parameters passed?
>
> For Lua 5, yes, definitely.  In Lua 4, no, there may be upvalues on top
> of the stack (but my memory of Lua 4 is fading so don't trust me).

<snip>