Created
February 19, 2020 15:23
-
-
Save MindScriptAct/f41355bbce355e1d853f830e287c686b to your computer and use it in GitHub Desktop.
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