lua-users home
lua-l archive

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


hi all, I have a idea about named function in a table constructor.

we know, function foobar()...end is just a semantics sugar of foobar = function()...end -- in mostly (not all) scene.

because in a table constructor, we can not write:

{
    function OnClick(evt)
        print("we are clicked")
    end
}

normally, it should be just the semantics sugar of:

{
    _OnClick_ = function(evt) print("we are clicked") end
}

but now (in Lua 5.1.4), we can only get:

 '(' expected near 'OnClick'

should we add this sugar into lparser.c?