function inverttable(table)
    local result
    if type(table) == 'table' then
        result = {}
        for k, v in pairs(table) do
            result[v] = k
        end
    end
    return result
end

return inverttable
