Hello. I recently just found about this thing called Filtering Enabled and omg it looks complicated.
I found some links to Remote Events and stuff but can't find a link about tuples.
Please help asap!
Regards, Nathan.
Hello. I recently just found about this thing called Filtering Enabled and omg it looks complicated.
I found some links to Remote Events and stuff but can't find a link about tuples.
Please help asap!
Regards, Nathan.
A tuple is an ordered list of elements. It means it accepts one or more arguments of any type. Tuple is written as three dots (...) in Lua.
-- param: tuple ...
function foo(...)
print(...)
end
foo(1,2,3)
> prints '1, 2, 3'
foo("Hi,", " there!")
> prints 'Hi, there!'
------
function bar(...)
args = {...}
script.Parent.Name = args[1]
script.Parent.BrickColor = args[2]
end
bar("Blue Brick", BrickColor.Blue())
> Changes the name to Blue Brick and it's color to Bright blue.
As you see, it's quite up to you how you use it. It's common to assign the tuple in a table in the function to easier handle it throughout the script.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Ahah! Thanks! :) Do you have any links aswell?
You can check out https://code.google.com/p/lua-files/wiki/tuple and http://wiki.roblox.com/index.php?title=Tuple, although the firstmentioned can be a bit technical. I don't find the ROBLOX Wiki to cover it too well, sadly
Usually you don't actually need to use (
...) though, because usually you know exactly how many parameters you are giving it! The remark that it is a tuple is just a technical specification that you CAN use as many as you want