Hey guys, so I’ve been learning about Metatables recently, and I’ve understood everything just fine until now. I noticed that in a tutorial I saw, two parameters of the same name were put into a function, and were divided by a colon instead of a comma. I have never seen anything like this before, and I can’t seem to figure out what it’s used for. Any help would be appreciated!
This is for use in Roblox’s type checker. It means that the thread will error if the parameters provided is not a player. You can do similar things with other types as well.
That’s only one argument, it’s just using Luau typechecking syntax which allows you to assign a type to a variable.
For example, defining a function like this would only actually take 2 parameters: actualArgument1, which should be a player, and actualArgument2 which should be a CFrame.
local function doSomething(actualArgument1: Player, actualArgument2: CFrame)
If you want to learn how to use Luau type checking, you can check out the docs: