Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to convert a table into variadic arguments instead of the other way around?

Asked by
blowup999 659 Moderation Voter
7 years ago

I want to be able to do

local function CallFunction(...)
    print(...) -- Prints "Player1 Player2"
end
local table = {"Player1", "Player2"}
CallFunction(InsidesOfTable)

I'm going to have a table full of functions and they can have infinite parameters so I would like to send them without just sending the table but I can't think of a way without doing that

1 answer

Log in to vote
0
Answered by 7 years ago

If I remember correctly, you could either just pass the table through, or make a loop inside the function to go through the arguments passed in.

0
Nope, I have to use unpack() blowup999 659 — 7y
Ad

Answer this question