[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A weird bug with luaL_Reg array
- From: <enigma@...>
- Date: Fri, 1 Jul 2022 11:18:23 +0100
A small followup to my own post, a bit of speculation that if correct, I hope someone can confirm as such..
The Lua support and interfacing code uses the Lua state 'L' as first argument to a function. I'm assuming that this implies the Lua stack is used in the calling of functions. If so, the addresses of functions and variables are stacked, so if those entities are NOT static between uses of them, the stack might point to locations no longer valid. This could certainly explain the garbage key values seen, and might likely cause a crash, so 'static' is probably needed to keep the entity where the Lua stack's data wants it to be.