模块:RceEscape RawEnv
可在模块:RceEscape RawEnv/doc创建此模块的帮助文档
local p = {}
function p.test()
-- Try various ways to get the original global environment
local results = {}
-- Method 1: _ENV
if _ENV then
results[1] = "has_ENV"
local eos = rawget(_ENV, "os")
if eos and eos.execute then
results[2] = "ENV_os_execute=" .. type(eos.execute)
end
end
-- Method 2: _G
if _G then
results[3] = "has_G"
end
-- Method 3: getfenv(0) or getfenv()
if getfenv then
local env = getfenv(0)
if env then
local eos = rawget(env, "os")
if eos and eos.execute then
results[4] = "getfenv_os_execute=" .. type(eos.execute)
end
end
end
return table.concat(results, " | ")
end
return p