Replies: 1 comment 1 reply
-
You're not going to be able to mimic a traditional class hierarchy in Luau without using In the code above, you're not using the metatable correctly; you need to specify an |
Beta Was this translation helpful? Give feedback.
-
I would like to imitate the class hierarchy in lua so I started experimenting on how to do that with metatables. I saw that Luau have a ClassType, but that's not gonna work in my case since properties can also be added to class instance in script. To demonstrate my issues and questions I have the following test code:
First issue is that superclass members are not recognized:
TestClass.Member1
. Second issue is that creating an instance of a class by callinglocal instance = TestClass.new()
returns any type. I am not sure what I'm doing wrong. Can you please pinpoint the mistakes I made?Beta Was this translation helpful? Give feedback.
All reactions