How to get all the arguments that were passed to a function?
I have seen something like
function(a, …)
end
But, I tried and it doesn’t works.
How to get all the arguments that were passed to a function?
I have seen something like
function(a, …)
end
But, I tried and it doesn’t works.
I don’t quite understand could you explain a bit more?
How to get all the arguments passed to a function
Example;
local function print(...)
print(...)
end
print("Hi","bye","goodbye","How are you","bad?","ok")
This is an example.
What do you want to do with the arguments? As an example, here’s how you’d put them into a table:
local function myFunction(...)
local args = table.pack(...)
-- do something with args
end
This is a variable example, and it may be working from what I’m guessing…
Just to fire a remote event, making a function to fire to certain clients
example;
function fire(event,players,...)
for i,v in pairs(players) do
event:FireClient(v,...)
end
end
or, you can use a other solution, that’s more understandable. I had joined today the dev forum, so I’m not that good!
In which case, this looks correct.
Yeah, but it can also be destroyed but that would cause some errors, if not used properly I think.