-- save models anymore.
if rawget(model, name) then
- error('We decorate the class, not the objects, and there is a `'
+ error('We decorate the classes, not the objects, and there is a `'
.. name
.. '\' function in '
.. tostring(model))
end
- local toDecorate = getmetatable(model)
+ local toDecorate = model
- if toDecorate[name] and not toDecorate[nameOrig] then
+ while not rawget(toDecorate, name) do
+ toDecorate = getmetatable(toDecorate)
+ end
+
+ if not toDecorate[nameOrig] then
+ print('Decorating ' .. toDecorate.__typename .. '.' .. name)
toDecorate[nameOrig] = toDecorate[name]
toDecorate[name] = function(self, ...)
local startTime = sys.clock()