PHP Classes

File: tests/WebPower/LuaSandbox/Tests/dumpGlobals.lua

Recommend this page to a friend!
  Classes of Christiaan Baartse  >  Lua sandbox  >  tests/WebPower/LuaSandbox/Tests/dumpGlobals.lua  >  Download  
File: tests/WebPower/LuaSandbox/Tests/dumpGlobals.lua
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Lua sandbox
Run Lua language code integrated with PHP code
Author: By
Last change: Update of tests/WebPower/LuaSandbox/Tests/dumpGlobals.lua
Date: 24 days ago
Size: 468 bytes


Class file image Download
local seen = {}
function dumpGlobals(t, prefix)
    seen[t] = true
    local names = {}
    for name in pairs(t) do
        table.insert(names, prefix .. name)
        local v = t[name]
        if type(v)=="table" and not seen[v] then
            local sub = dumpGlobals(v, prefix .. name .. '.')
            for sub_k,sub_v in pairs(sub) do
                table.insert(names, sub_v)
    return names
return dumpGlobals(_G, '')
For more information send a message to info at phpclasses dot org.