Hard Crash the phone printing out the _G table in Lua

Hard Crash the phone printing out the _G table in Lua
0.0 0



If I try and print out the _G table recursively it hard crashes my phone - Android Galaxy s. I’ve attached the code I use PrintTable(_G). This definitely shouldn’t happen but I’m quite new to mobile development and my current development environment is useless to help my track down this issue.

“Zygote terminate by signal 6” seems to be where it dies!

I’m guess it’s some issue with how some of the classes are exposed to Lua but I’m not really sure where.


PrintTable.lua.zip (1.5 KB)

function dump(object, label, nesting, nest)
    if type(nesting) ~= "number" then nesting = 99 end

    local lookup_table = {}
    local function _dump(object, label, indent, nest)
        label = label or ""
        if type(object) ~= "table" then
            print(string.format("%s%s = %s", indent, tostring(label), tostring(object)..""))
        elseif lookup_table[object] then
            print(string.format("%s%s = *REF*", indent, tostring(label)))
            lookup_table[object] = true
            if nest > nesting then
                print(string.format("%s%s = *MAX NESTING*", indent, label))
                print(string.format("%s%s = {", indent, tostring(label)))
                local indent2 = indent.."    "
                for k, v in pairs(object) do
                    _dump(v, k, indent2, nest + 1)
                print(string.format("%s}", indent))
    _dump(object, label, "- ", 1)

try dump(_G, “_G”, 2)