Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Why does this cause a stack overflow? [LUA]

Name: Anonymous 2013-01-08 21:18

function printtable (t)
    for i,v in pairs (t) do
        strbuf = ""
        for iter=1, tabs, 1 do
            strbuf = strbuf .. '\t'
        end
        print(strbuf, v)
        if type(v) == "table" then
            tabs = tabs + 1
            printtable(v)
        end
        tabs = tabs - 1
    end
end

tabs=0
printtable(_G)


It shouldn't recurse that much.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List