lua-users home
lua-l archive

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


On Sun, Nov 14, 2021 at 3:26 PM Benjamin Riggs <riggs@entropicengineering.com> wrote:
Thanks for the detailed explanation! Did I miss this description in my read of the reference manual (I did skip the grammar)?

Partially; https://www.lua.org/manual/5.4/manual.html#3.3.2 explains that "Lua handles a chunk as the body of an anonymous function with a variable number of arguments (see §3.4.11). As such, chunks can define local variables, receive arguments, and return values."

Once you understand from that passage that a chunk is just an ordinary anonymous function, the rest of what I described logically follows from the normal behavior of functions.