Skip to content

Instantly share code, notes, and snippets.

@saga
Created July 22, 2011 00:54
Show Gist options
  • Save saga/1098601 to your computer and use it in GitHub Desktop.
Save saga/1098601 to your computer and use it in GitHub Desktop.
lua method_missing
t = {}
meta = {__index =
function(_, idx)
return function(...)
-- ... will be table type "arg"
print(idx, arg[1])
end
end}
setmetatable(t, meta)
t.foo("abc")
t.bar("de")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment