lua-users home
lua-l archive

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

You're wrong: the code is effectively compiled as a function, which will be called (even if this is not by prepending/appending Lua source code, there's effectivly some bytecode implicitly added by the compiler, at start and end of the compiled source code, to make it a valid binary-compiled function).

Le lun. 8 nov. 2021 à 21:10, Luiz Henrique de Figueiredo <> a écrit :
> You probably do not see that this script is actually embedded at runtime in a block starting at line 1: the start of the block (which actually makes an anonymous function) has active (invisible) code prepended at start of the line, even if line 1 is then only followed by a comment. The script is also followed by an end of block containing some active code (with an implicit return statement just before it, and a function call just after it), but this appending does not increment the line counter.

This is definitely not true: the Lua compiler does not prepend or
append any text to the code it receives. Use my ltokenp token
processor to see the stream of tokens that the compiler receives.