Skip to content

EmmyLua

Devon Palma edited this page Nov 6, 2024 · 1 revision

The origin of LowerClass was simply because using MiddleClass with EmmyLua sucked. Therefor LowerClass is designed to best support EmmyLua. Here is an example of how you might create a fully documented class

---@class TestTreeClass : Class, TreeMixin
---@field new fun(self: BuildableClass, x: number, y: number): TestTreeClass 
local TestTreeClass = LowerClass("TestTreeClass", TreeMixin)
function TestTreeClass:__init(x, y)
  self.x = x
  self.y = y
end

---@class ExpandedTreeClass : TestTreeClass
local ExpandedTreeClass = LowerClass(TestTreeClass)

That's about it! Now EmmyLua will be able to give you all associated functions and variables associated with TestTreeClass. Both the class variable and the instance variables will use TestTreeClass as the lookup table for providing annotation support.

Clone this wiki locally