Module:Hook

local p = {}

function p.add(k, v)	if not INTERNAL_HOOK_TABLE then -- set global table of hooks INTERNAL_HOOK_TABLE = {} end if not INTERNAL_HOOK_TABLE[k] then INTERNAL_HOOK_TABLE[k] = {} end INTERNAL_HOOK_TABLE[k][#INTERNAL_HOOK_TABLE[k]+1] = v end

function p.run(key, ...) if INTERNAL_HOOK_TABLE and INTERNAL_HOOK_TABLE[key] then for _, f in ipairs(INTERNAL_HOOK_TABLE[key]) do			if not f(...) then return false end end end return true end

return p