function Registry.RegisterHook(t,d,y,I)if not t.Hooks[d]then error(("\073\110\118\097\108\105\100 \104\111\111\107 \110\097\109\101\058 \037\113"):format(d),2)end table.insert(t.Hooks[d],{callback=y;priority=I or 0})table.sort(t.Hooks[d],function(d,y)return d.priority<y.priority end)end
--- Adds a hook to be called when any command is run
function Registry:RegisterHook(hookName, callback, priority)
	if not self.Hooks[hookName] then
		error(("Invalid hook name: %q"):format(hookName), 2)
	end

	table.insert(self.Hooks[hookName], { callback = callback, priority = priority or 0 })
	table.sort(self.Hooks[hookName], function(a, b)
		return a.priority < b.priority
	end)
end
