i know you can create a custom datatype like that:
type NameDoNotMatter = {
-- anything here
}
so for example if we do:
type BlaBlaBla = {
D: number,
G: string
}
then if we do:
local d: BlaBlaBla
d.D -- Number
d.G -- String
but can you make a function like?
CustomDataType:FunctionName
or
anyString:Format
RatiusRat
(Boopmaster)
#2
Yeah you can give a custom datatype functions (because they are basically tables) but not the default ones.
RatiusRat
(Boopmaster)
#3
Also custom datatypes by roblox are created by constructors of a class thus why they can have functions that are inherited.
i have an idea!
() → () means function.
so i can do this but then in the constructor function, i define the efuncction"
RatiusRat
(Boopmaster)
#5
What do you mean? All you need to do is define the functions of the class then let the datatype inherit it.
1 Like
koziahss
(Agent_Invalid)
#6
also if you want to control function arguments types you can do this:
--type module
export type myFunction<Type> = (argument: Type) -> (number)
1 Like