[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Strange way to determine whether it is Lua or C function
- From: Viacheslav Usov <via.usov@...>
- Date: Mon, 24 Aug 2020 09:49:35 +0200
On Sun, Aug 23, 2020 at 5:26 PM Viacheslav Usov <email@example.com> wrote:
> The coroutine business ensures that the test subjects never actually run.
As established in an erroneous spin-off bug thread, the yield results
in an error rather than a normal yield. Which suggests that coroutines
are not in fact a necessary means toward this end. Indeed, the
following code seems to achieve the same effect without coroutines:
local debug = require 'debug'
local function is_C_function(func)
if debug.getinfo(2, 'f').func == func then
x = debug.getlocal(2, 2)
return not x