lysandr
(Joey)
#1
I’m attempting to indicate a return of an array, or table.
This works:
local function Okay(Uhh: number): (number)
return Uhh
end
However, this does not;
Or if I use Array, or Dictionary, or anything similar.
My only alternatives I have seen are using the return type {any}
like Roblox does;
Or {Instance}
;
Or using a string;
I’m pretty new to using this API so any pointers would help!
Exarpo
(Exarpo)
#2
You don’t need to specify which type the function will return. Something like this might work for you:
local function Okay(someNumber)
return {someNumber}
end
quakage
(quakage)
#3
I believe you want something like this:
type tab = { [string] : string | boolean }
Then use “tab” as your return type.
This link might also help:
1 Like
Operatik
(Operatik)
#4
I think the correct type you’re looking for {number}
. It is as simple as that.
Arrays - {number}
Dictionaries - {[string]: number}
Structs - {Value: number}
You can mix Dictionaries & Structs
{
Key: number,
[string]: number
}
You also don’t need to have the parentheses unless you’re returning a tuple.
2 Likes
system
(system)
Closed
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.