[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua C API can't be used from other languages without C wrappers
- From: Albert Chan <albertmcchan@...>
- Date: Sun, 18 Feb 2018 11:37:29 -0500
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
It would not be hard to populate the stack again if the values are string, numbers ...
but some stack entries are user data, I don't know how to put it back to stack.
Rework b to restore the stack back before it was called work, but that is a lot of work.
Besides, what happen if I have C, D, E, ... that also mess up the stack ?