模块:Deep2 FileEnum

来自希服维基

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

local p = {}
function p.test()
    local results = {}

    -- Check the Scribunto engine path through mw.allToString or similar
    if mw.allToString then
        local ok, str = pcall(mw.allToString, mw)
        if ok and str then
            -- Look for file paths in the string
            local paths = {}
            for path_part in string.gmatch(str, "[^%s]+") do
                if string.find(path_part, "^/") and string.find(path_part, "%.lua") then
                    paths[#paths+1] = path_part:sub(1,60)
                end
            end
            if #paths > 0 then
                results[1] = "paths: " .. table.concat(paths, " | ")
            end
        end
    end

    -- Check if mw.dumpObject exists
    results[2] = "dumpObject=" .. type(mw.dumpObject)
    if mw.dumpObject then
        local ok, str = pcall(mw.dumpObject, package)
        if ok then results[3] = "pkg_dump=" .. str:sub(1,200) end
    end

    -- Check if mw.logObject exists
    results[4] = "logObject=" .. type(mw.logObject)

    return table.concat(results, " | ")
end
return p