lua-users home
lua-l archive

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


On Mon, 2022-12-05 at 17:11 +0100, Aleksandr Zenkov wrote:
> Thank you for the reply.
> 
> Actually no, the Lua script is loaded all the time during runtime.
> The 
> Lua functions within the script are called using lua_getglobal, here
> is 
> the exact C++ caller function:
> 
> https://github.com/Verlihub/verlihub/blob/master/plugins/lua/cluainterpreter.cpp#L247
This function is a bit weird. You emtpy the stack and then get the
number of stack items (line 262, into 'base'), which will always be 0.
Then you push "_TRACEBACK" and the global table, only to (I guess
that's what you want to do) reverse the order of those two.
First of all you call lua_insert with index 0, which is not valid.
Secondly, why use lua_insert at all when you can just push the stuff
you need in the right order?
Anyway, I'd start with checking the indices, maybe I'm missing
something here, but this caught my attention.

Kind regards,
Patrick