Login   Register  
PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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:
Date: 2012-11-03 03:41
Size: 468 bytes
 

Contents

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)
            end
        end
    end
    return names
end
return dumpGlobals(_G, '')