Skip to content

Instantly share code, notes, and snippets.

@d9i
Created March 1, 2012 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d9i/1951200 to your computer and use it in GitHub Desktop.
Save d9i/1951200 to your computer and use it in GitHub Desktop.
Fun with metatables
-- Use single inheritance to do fun things with tables
mt = {}
mt.__index = function (t, k)
tbl = {}
setmetatable(tbl, mt)
return tbl
end
setmetatable(_G.table, mt)
print(m.e.t.a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment