How to take unspecified number of arguments

Sorry for creating a topic over such a small issue but I could not find the answer on the web.
So here is my simple script :

It works fine but my aim is to provide an unspecified number of arguments and not a table as a whole.
How can I achieve this?

Use the ... arguemnt to make it a variadic function, meaning a number that takes in any number of arguments.

An example of a variadic function is print, you can give it as many arguments as you want.

https://developer.roblox.com/en-us/articles/Variadic-Functions

Edit: I think one of the examples in the article I sent would do the exact same thing as you want, a sum function

3 Likes

So if I understand right your trying to do something like pythons
*args **kwargs

Except in lua

Ah so these are known as variadic functions.
Thanks .

1 Like