In Ruby, objects have a handy method called method_missing which allows one to handle method calls for methods that have not even been (explicitly) defined:
method_missing
This is accomplished in Lua by setting the __index key of a metatable.
__index
t = {} meta = {__index = function(_, idx) return function() print(idx) end end} setmetatable(t, meta) t.foo() t.bar()
This code will output:
foo bar