lua-users home
lua-l archive

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


Thanks Roberto! I will incorporate those as a check in my application.

Andrew, 
By enabling the API checks you mean these lines in lapi.h? :

#define api_incr_top(L)   {L->top++; api_check(L->top <= L->ci->top, \
"stack overflow");}

#define adjustresults(L,nres) \
    { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }

#define api_checknelems(L,n) api_check((n) < (L->top - L->ci->func), \
 "not enough elements in the stack")

On Mon, Jun 17, 2019 at 7:38 PM Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> Is there any function in Lua or library or any code modification to Lua
> itself, that can be called to verify the Lua state, internal pointers and
> state of the stack and heap at runtime?

You may have a look at 'lua_checkmemory', implemented in the file
'ltests.c' from the test suite [1].

[1] https://www.lua.org/tests/

-- Roberto