- if not rawget(functionTable, name) then
- functionTable = getmetatable(model)
+ -- We decorate the function where it is defined in the class
+ -- hierarchy, so we have to go up the metatables until we find
+ -- it with rawget
+
+ while functionTable and not rawget(functionTable, name) do
+ functionTable = getmetatable(functionTable)