Let’s say I want to pass a function as a parameter for another function
function example(parameter)
parameter()
end
How would I write this in LuaU? If parameter
were a number it would look something like this
function example(parameter : number)
print(parameter)
end
So if I want parameter
to be a reference to a function I should just type function
instead of number
like this, right?
function example(parameter : function)
parameter()
end
Well, when I try this I get a red underline that displays an error when highlighted
Syntax error: Expected type, got 'function'
I get this same error if I try to run the code anyway. So how do I do this?
Thanks in advance.