[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Can C code recognize, whether Lua inside some loop/block? (for/while/repeat/if)
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 16 Feb 2022 06:43:19 -0300
> In general, you cannot [1]. In particular, there is no way to detect if
> Lua is executing within a loop. The following Lua code:
>
> [...]
Not to mention optimizations, gotos, and other strange constructions:
- if x then return end
FOO()
Syntactically, the call is not inside an 'if', but semantically it is.
- repeat FOO() until true
Syntactically, the call is inside a loop, but semantically it isn't.
(See the opcodes!)
-- Roberto