lua-users home
lua-l archive

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


local function foo() ... end -- hides the part where it
forward-declares the identifier for use within the same function

I've said this before, but I avoid writing functions with that form
because I like 'function' and 'end' lining up on indentation levels.
It just looks a bit funkey to do the forward declaration yourself for
recursive functions:

local foo = nil -- I prefer to assign nil at minimum
foo =
    function (x, y, z)
        ...
        if some_condition then
            foo(x, y, z)
        end
        ...
    end

[/tangent]