So I'm trying to make an event happen when a function is being called from a table, using colons (:). Here's what i have to far:
local this = {}
setmetatable(this, {
__index = function(t,k)
print'Metamethod was invoked'
return getfenv()[k] -- return normal
end
})
function this:test()
return 'test'
end
print(this:test()) -- > prints 1, but doesn't invoke the __index metamethod?
Anyway i can catch a function being called from a table like this?
