function Registry.RegisterHook(l,R,M,e)if not l.Hooks[R]then error(("\073\110\118\097\108\105\100 \104\111\111\107 \110\097\109\101\058 \037\113"):format(R),2)end table.insert(l.Hooks[R],{callback=M,priority=e or 0})table.sort(l.Hooks[R],function(R,M)return R.priority<M.priority end)end

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
