lua-users home
lua-l archive

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


> Although "local function X ... end" is basically syntax sugar for
> "local X = function ... end", it isn't exactly equivalent, as this
> example shows:  The former syntax makes the definition visible to the
> function body, whereas the latter syntax does not.

The manual [2] is clear about this:  "local function X ... end" is
equal to "local X; X = function end" and NOT to "local X = function
end".
This makes the use of recursive local functions easier to write.

[2] http://www.lua.org/manual/5.2/manual.html#3.4.10