So lately I want to learn more about scripting and I saw this kind of code in function , local function CheckReferenceType(reference: Reference): {any}?
what does reference:Reference mean?
What does : mean tho in function?
I recommend reading this article, it’s helpful.
[Press ‘Get Started’]
colons after variable declarations indicate types in Luau (scripting language of roblox) - the {any}? bit after the function indicates the return type of the function. I guess it’s more intuitive if you’re familiar with other programming languages such as Java/C++
Types are technically optional in Luau as far as I’m aware but they make things like autocomplete work better so it can be good to use them.
local var:number = 4
-- functionally, these are both var with a value of 4
-- but the one on the top is given an explicit type
local var = 4
4 Likes
Ah yes i get it, thank you for your answer.
1 Like