Skip to content

Instantly share code, notes, and snippets.

@MindScriptAct
Last active May 1, 2023 16:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MindScriptAct/bf5e4cb1284eece29ac6392ad02d4260 to your computer and use it in GitHub Desktop.
Save MindScriptAct/bf5e4cb1284eece29ac6392ad02d4260 to your computer and use it in GitHub Desktop.
TableTop simulator lua class template
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