I know this is already answered, but I'd like to add on to what Azure said.
So in the Java programming language, there's a concept called "overloading", it means that you can have 2 functions with the same name but 2 different sets of arguments:
function a(arg1)
print(arg1)
end
function b(arg1,arg2)
return arg1+arg2
end
Unfortunately, this will not work in lua, which is where the ... argument comes in. You can do the same thing as above, just structured differently:
function a(...)
local args = {...}
if #args == 1 then
print(args[1])
elseif #args == 2 then
return args[1]+args[2]
end
end
I just checked for the number of arguments in the table because I knew the first function took 1 argument and the second took 2, but you can also check the type and value of the arguments to set them apart allowing you to have more freedom in adding as much functionality as you want to the function a().
5 comments
I mean when we call the function not when we declare it.
You simply give the tuple from where the original tuple is from to the function when you call it, i checked the link you gave, it takes whatever parameters inside line 30's tuple, and then give it to line 31, which fired Line 53's function and give whatever parameter inside the tuple to the function, which is the part that triggers line 30's .Touched event.
I get it now, thank you for answered my question.
Quick thing to add, in lua, tables start with the index at 1 not 0. But don't worry about it too much, it's a common mistake especially if your main language is not lua.
@SteamG0D yes you are rightt, thanks