add aussiemons code

This commit is contained in:
Dan Reeves 2023-01-11 01:14:07 +00:00
parent eca671c7f7
commit 17606ca944

View file

@ -499,11 +499,17 @@ end
-- #################################################################################################################### -- ####################################################################################################################
-- If class() is called on an object we've delayed for, re-run delayed hooks -- If class() is called on an object we've delayed for, re-run delayed hooks
dmf:hook_safe(_G, "class", function(class_name) dmf:hook(_G, "class", function(func, class_name, ...)
local class_object = func(class_name, ...)
if _delayed_obj_names[class_name] then if _delayed_obj_names[class_name] then
dmf:info("%s is now available for previously-delayed hooks.", class_name) dmf:info("%s is now available for previously-delayed hooks.", class_name)
dmf.apply_delayed_hooks()
-- Methods aren't defined yet, so we need to wait for the instance creation to apply delayed hooks
dmf:hook_safe(class_object, "new", function ()
dmf.apply_delayed_hooks()
_delayed_obj_names[class_name] = nil _delayed_obj_names[class_name] = nil
end dmf:hook_disable(class_object, "new")
end)
end
return class_object
end) end)