[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Strange way to determine whether it is Lua or C function
- From: Paul K <paul@...>
- Date: Sun, 23 Aug 2020 13:36:09 -0700
Hi Egor,
> So, the code actually checks the parameters/registers of the "func" stack frame.
Correct; my guess was wrong. Thank you for the explanation.
Paul.
On Sun, Aug 23, 2020 at 9:20 AM Egor Skriptunoff
<egor.skriptunoff@gmail.com> wrote:
>
> On Sun, Aug 23, 2020 at 6:18 PM Paul K wrote:
>>
>> It looks like it checks the "line" parameter of the debug hook (it
>> will be the second function from the top),
>
>
> No.
> The hook function is the first function from the top.
> The second function from the top is the "func" (the function
> passed as an argument for is_C_function).
> It could be verified by inserting the following statement inside the hook
> print("Stack level 2 is 'func':", debug.getinfo(2).func == func)
>
> So, the code actually checks the parameters/registers of the "func" stack frame.