in this video I show that you CAN have cyclic types, as long as they are all in the same script.
the implications for something like this existing for modulescripts is insane, it would make my life infinite times easier, it would things like intellisensed children types and component based objects easier by an INSANE amount.
is there any way you lovely devforum scripting support browsers can think of to get around this issue?
edit: if not can a regular on the devforum make a feature request for a method to extract only the exported types from a modulescript and not require the whole modulescript at runtime?
edit2: fixing a goof my cat made when he stepped on my keyboard
languages like C# have type namespaces so you can have global types shared across all scripts. This makes it harder to do something like Unity’s component based gameobject logic.
I was wondering if there was any easier way to do something like that.
like if there was a way to get only exported type definitions from a module instead of straight loading it.
edit: and luau already has cyclic types, just they have to be confined within the same script, as shown here
unfortunately no, the only solution I can imagine is using ScriptEditorService to hack in autocomplete for a certain type, but when anything dealing with typing at runtime comes out it will break
roblox really should add something similar to type namespaces instead of just using modulescripts
decent idea but unfortunately luau is a multi-paradigm language, the support for classes are in metatables. and metatables are extremely powerful in class construction in general.
the only downside is inheritance…
to register a class “inheriting” from another class you would need to do something like this
local InheritingFrom = {}--yadda yadda
InheritingFrom.__index = InheritingFrom
local Module = setmetatable({}, InheritingFrom)
Module.__index = Module
function Module:Method()
end
function Module.new()
local self = InheritingFrom.new()
self.property = "index"
return setmetatable(self, Module)
end
return Module