lua-users home
lua-l archive

Re: Lua C API can't be used from other languages without C wrappers

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


2018年02月18日 18:37 GMT+02:00 Albert Chan <albertmcchan@yahoo.com>:
> I have trouble using Lua C stack, even in C
>
> Say, I have a c function A that uses lua stack, that call another c function B
> that also uses c lua stack. however, B did a lua_settop of 1, then return 1.
>
> Sine both c functions share the same stack, A loses everything except the result of B
They do not. Every call generates a new stack frame, and no function
can see further back than its own arguments, except those values that
have been exported into its closure as upvalues. What you describe
cannot happen.

AltStyle によって変換されたページ (->オリジナル) /