Skip to content

Instantly share code, notes, and snippets.

@blm768
Created July 1, 2017 16:16
Show Gist options
  • Save blm768/bb10fefc723305153588897cb01a6d66 to your computer and use it in GitHub Desktop.
Save blm768/bb10fefc723305153588897cb01a6d66 to your computer and use it in GitHub Desktop.
Lua class code
Class = {}
function Class:new(super)
local class = {}
if super ~= nil then
local class_mt = {__index = super}
setmetatable(class, super)
end
local object_mt = {__index = class}
class.new = function(self, ...)
local object = {}
setmetatable(object, object_mt)
if object.initialize then
object:initialize(...)
end
return object
end
return class
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment