13

在 Lua 中,是否有相当于 Javascript 的 apply() 函数?

4

1 回答 1

13

尝试使用()unpack

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

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