Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local _M = {} -- module table
- _M.someProperty = 1 -- class properties
- local function createText()
- -- local function are still valid, but not seen from outside - "private"
- end
- local privateVar -- so do local variables
- _GLOBAL_VAR -- without local it's global
- function _M.staticMethod(vars)
- -- this is class method like function (dot)
- -- there is no "self"
- end
- function _M:someMethod(vars)
- -- this is object method like function (colon)
- -- there is "self"
- end
- return _M -- return this table as a module to require()
- return _M
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement