Skip to content

Instantly share code, notes, and snippets.

@cheald
Created January 22, 2013 02:51
Show Gist options
  • Save cheald/4591677 to your computer and use it in GitHub Desktop.
Save cheald/4591677 to your computer and use it in GitHub Desktop.
local Prototype = {}
local Prototype_mt = {__index = Prototype}
function Prototype.do_stuff(times)
-- Do stuff
end
function Prototype:new()
local new_inst = {} -- the new instance
setmetatable( new_inst, Prototype_mt ) -- all instances share the same metatable
return new_inst
end
Prototype:new():do_stuff(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment