lua-users home
lua-l archive

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


On Mon, Sep 25, 2006 at 04:58:59PM -0700, Ken Smith wrote:
> Right.  Ok.  I can use the non-syntactic sugar version to create my
> list of functions.  Thank you for the responses.

You may know, but if defining functions in order ([1], [2], ...) you also can do:

vtable = {
    function (x)
        print(x)
    end,
    function (y)
        print(y*2)
    end,
    -- ...
}

t[2](5)