This however only gave me more questions. So, I read the Luau syntax page but the example they provided still didnt make it clear enough, only including this snippet and a little bit of text basically saying “Oh, yeah! You can do this too, but we’re not going to elaborate on it!”
local foo: (number, string) -> boolean
Im still just getting used to the Luau syntax and type checking. Been using Lua for ages but with the addition of Luau ive been getting lost everywhere and learning tons of new concepts, this being one of them.
I’m not too sure if I’ve got this entirely correct, so correct me if I’m wrong.
“->” defines the return types of variables. In Luau, you use a “:” instead. So you could do this:
local function addNumbers(numberOne:number, numberTwo:number): (number) --we will return a number
return numberOne + numberTwo --here is that number we will return
end
local answer = addNumbers(5, 7)
print(answer)