Created
March 1, 2012 16:41
-
-
Save d9i/1951200 to your computer and use it in GitHub Desktop.
Fun with metatables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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