在我的lua脚本中,我需要调用一个函数,该函数接受一个具有大量参数的参数,以及任意数量的参数......
我正在建立我的论据作为一个表,因为我不知道会有多少论点.
示例代码:
local result = call.someFunc();
local arguments = {}
for k,v in pairs(result) do
table.insert(arguments, v.name)
end
-- here I would like to somehow pass the whole table and each item in the table
-- is then passed as a single argument to "someOtherFunc"
call.someOtherFunc(arguments[1], arguments[2], arguments[3] ....)
Run Code Online (Sandbox Code Playgroud)
我对lua很新,在PHP中我会使用call_user_func_array - 在lua中有类似的东西吗?