lua-users home
lua-l archive

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


On 13 April 2012 17:53, Antonio Vieiro <antonio@antonioshome.net> wrote:
> Hi all,
>
> I have a question that I'd like more experience users to answer.
>
> Imagine I'm writing a C function to be called from Lua.
>
> This C function receives 10 arguments in the Lua stack.
>

> So that I return 2 arguments : nil and an error string?
>
> If so, what happens with the other 10 elements in the stack? Does Lua clean
> the up automatically or am I supposed to clean all the arguments before
> pushing my return values in the stack?
>

No, Lua will clean up the other values on the stack for you, as
documented here:
http://www.lua.org/manual/5.1/manual.html#lua_CFunction

Regards,
Matthew