
pmb_inventory.registered_formspec_addons = {}
local fs_addons = pmb_inventory.registered_formspec_addons
function pmb_inventory.register_formspec_process(in_formspec, tag, func)
    if not fs_addons[in_formspec] then fs_addons[in_formspec] = {} end
    fs_addons[in_formspec][#fs_addons[in_formspec]+1] = {tag=tag, func=func}
end

function pmb_inventory.get_formspec_of_type(formspecid, flags)
    flags = flags or {}
    local out = {}
    for i, callbackdef in ipairs(fs_addons[formspecid] or {}) do
        out[#out+1] = callbackdef.func(flags)
    end
    return table.concat(out)
end
