Last active
May 1, 2023 16:55
-
-
Save MindScriptAct/bf5e4cb1284eece29ac6392ad02d4260 to your computer and use it in GitHub Desktop.
TableTop simulator lua class template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local MyClass = {} | |
MyClass.__index = MyClass | |
setmetatable(MyClass, {__call = function (cls, ...) return cls.New(...) end }) | |
function MyClass.New(initData) | |
local self = setmetatable({}, MyClass) | |
self.data = initData | |
return self | |
end | |
function MyClass:SetData(newData) | |
self.data = newData | |
end | |
function MyClass:PrintData() | |
print(self.data) | |
end | |
function MyClass:DoStuff() | |
print("doStuff!!") | |
end | |
return MyClass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment