RosettaCodeData/Task/Respond-to-an-unknown-method-call/Lua/respond-to-an-unknown-method-call.lua
2023-07-01 13:44:08 -04:00

4 lines
200 B
Lua

local object={print=print}
setmetatable(object,{__index=function(t,k)return function() print("You called the method",k)end end})
object.print("Hi") -->Hi
object.hello() -->You called the method hello