Lua metatables and metamethod - How to call a different member function
I have the following Class local PROGRESS = {} PROGRESS.__index = function(self,key) if key~="__group" and self.__group[key] then return self.__group[key] else return rawget(self,key) end end What this does is when You access table[key] it performs a lookup in table.__group (which is an object of another class) and returns table.__group[key] ,if it is not nil. Now I am trying to do the same for member functions. i.e If I call table:key() a lookup must be performed in table.__group and if the function is present, then table.__group:key() should be called. How do I accomplish this? I tried to do