Last active
August 29, 2015 14:00
-
-
Save katlogic/c6b3c961a1a71bde67b1 to your computer and use it in GitHub Desktop.
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
local funtab=setmetatable({}, {__mode="k",__index=function(t,k) t[k]={}; return t[k] end}) | |
debug.setmetatable(function() end, { | |
__index=function(f,k) | |
return funtab[f][k] | |
end, | |
__newindex=function(f,k,v) | |
funtab[f][k] = v | |
end | |
}); | |
local function this() | |
return debug.getinfo(2,"f").func | |
end | |
function f() | |
print(this().x) | |
end | |
f.x = 1234 | |
f() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment