Alex Rivera | Logout

Is there a lua equivalent of javascript's apply()?

Asked 2013-01-23T07:07:49.653
14

In Lua, is there an equivalent of Javascript's apply() function?

Edit
Report

1 Answer

14

Try using () and unpack

function sayhello(name, message)
    print("hello " .. name .. ". " .. message)
end

func1 = sayhello
args1 = {"test", "how are you"}
func1(unpack(args1))
answered 2013-01-23T07:16:47.347

Your Answer