[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua C API can't be used from other languages without C wrappers
- From: Andrew Gierth <andrew@...>
- Date: Sun, 18 Feb 2018 22:06:39 +0000
>>>>> "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.