lua-users home
lua-l archive

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


On Mon, Feb 25, 2013 at 3:28 PM, Alfredo Palhares
<masterkorp@masterkorp.net> wrote:
> Its there a way to call a method based on a string ?
> like method = "set" .. key and the use it?

Very easy.

    local method = "set_" .. key
    obj[method](obj,....)

Note passing the object as the first argument - that's basically all
what : does.