Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function id(table)
- return table.__id or (tostring(table) or ""):match(" ([%w]+)")
- end
- local function class(metatable)
- local metatable = metatable or {}
- metatable.__id = id(metatable)
- metatable.__index = metatable
- metatable.__construct = metatable.__construct or function () end
- return metatable
- end
- local function object(metatable, ...)
- local table = {}
- table.__id = id(table)
- setmetatable(table, class(metatable))
- table:__construct(...)
- return table
- end
- return object, id, class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement