lua-users home
lua-l archive

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

> I may be confused but...
> On Tue, Aug 3, 2021 at 12:57 PM aman agrawal <> wrote:
> ...
> >> I'm trying to run the attached program in Lua 5.2.2 and 5.4.3 but I'm getting different number of arguments in Lua stack when I check in hook function. Is anything changed related to Lua hook function call?.
> Something seems to have changed, your code proves that. But AFAICS
> nothing is said in the docs regarding the stack contents on hook
> functions calls, so you seem to be purposely hitting undefined (tm)
> behaviour ( I may have misread the docs, please point me to the
> appropiate point if you know some place where stack contents are
> documented ) .

Right. The stack content during hooks is mostly undefined. Hooks neither
receive nor return anything through the stack, and the stack content
represents the internal code state when the hook is called.

The only thing significant in the stack during hooks are parameters
and return values during respectively call and return hooks. That
information became more organized in 5.4 with the creation of
fields fTransfer and nTransfer in the lua_Debug structure.

-- Roberto