Created
May 2, 2016 20:15
-
-
Save eevee/ddc7e5ea7b076155c2b988c0f4b20322 to your computer and use it in GitHub Desktop.
lua metatable shenanigans
This file contains hidden or 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
Lua 5.3.2 Copyright (C) 1994-2015 Lua.org, PUC-Rio | |
> mt = {__index = function(t, k) print("[" .. k .. "]") end} | |
> x = 3 | |
> debug.setmetatable(x, mt) | |
3 | |
> x.hello | |
[hello] | |
nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment