Add Functionality to allow functionality for the addon to be loaded as modules
DomenikIrrgang opened this issue ยท 1 comments
Beispielklasse:
util.lua
function CreateClass()
local newClass = {}
newClass.__index = newClass
setmetatable(newClass, {
__call = function (cls, ...)
return cls.new(...)
end,
})
return newClass
end
Usage:
ExampleClass = CreateClass()
function ExampleClass.new()
local self = setmetatable({}, ExampleClass)
self.exampleInstanceVarible = "Hello World"
return self
end
function ExampleClass:HelloWorld()
print(self.exampleInstanceVarible)
end
local test = ExampleClass()
test:HelloWorld()