模块:Deep2 IOCheck2

来自希服维基

可在模块:Deep2 IOCheck2/doc创建此模块的帮助文档

local p = {}
function p.test()
    -- Do a more thorough io check
    local results = {}
    for _, libname in ipairs({"io", "os", "file", "posix"}) do
        local ok, lib = pcall(require, libname)
        results[#results+1] = libname .. "_require=" .. tostring(ok)
        if ok and type(lib) == "table" then
            local fns = {}
            for k, v in pairs(lib) do
                if type(v) == "function" then
                    fns[#fns+1] = k
                end
            end
            if #fns > 0 then
                results[#results+1] = libname .. "_fns: " .. table.concat(fns, ", ")
            end
        end
    end
    return table.concat(results, " | ")
end
return p