模块:Deep2 AllGlobals

来自希服维基

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

local p = {}
function p.test()
    local count = 0
    local names = {}
    local mt = getmetatable(_G)
    local mt_str = "no_mt"
    if mt then
        mt_str = ""
        for k, v in pairs(mt) do mt_str = mt_str .. k .. "=" .. type(v) .. ";" end
    end
    for k, v in pairs(_G) do
        count = count + 1
        if count <= 80 then
            if type(v) ~= "function" and type(v) ~= "table" then
                names[#names+1] = k .. "=" .. tostring(v):sub(1,30)
            end
        end
    end
    return count .. " globals | metatable:" .. mt_str .. " | non-fn: " .. table.concat(names, ", ")
end
return p