lua-users home
lua-l archive

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


>>>>> "Albert" == Albert Chan <albertmcchan@yahoo.com> writes:

 Albert> I have trouble using Lua C stack, even in C

 Albert> Say, I have a c function A that uses lua stack, that call
 Albert> another c function B that also uses c lua stack. however, B did
 Albert> a lua_settop of 1, then return 1.

If A calls B _as a C function_, then B should not be using settop or
making assumptions about the start of the lua stack.

If you want B to be able to use the stack freely without affecting the
caller, then you just call it with lua_pushcfunction and lua_call rather
than directly.

-- 
Andrew.