Is there a better way to see if my table exists?

Is there a better way to see if my table exists? 

Basicly I have a table that resembles this:

table = { { {0 },{0,1},{0 },{0,1} }, { {0,1},{1 },{0,1},{1 } }, { {0 },{0,1},{0 },{0,1} }, { {0,1},{1 } }, { {0 }, }, { {0,1},{1 },{0,1},{1 } }, { {0 },{0,1},{0 },{0,1} }, { {0,1},{1 },{1 } }, }

except that the real table has more random and longer sets of 0s and 1s.

These strings of 0s and 1s are also dynamic and may or may not exist

Currently before I do an action I do an if then check like: 

if table[3] and table[3][2] and table[3][2][3] then --do awesome things like: table[3][2][3] = table[3][2][3] + 1 end

So, is that the best way to ensure this value exist before manipulating it?

Thanks,

Gullie

I think the way to go is to make your own function. I came up with this:

[lua]local function isInt(t, loc)

    for i = 1, #loc do

        t = t[loc[i]]

        if not t then return false end

    end

    if type(t) == “number” then

        return true

    end

    return false

end

if isInt(table, {3,2,3} then

    – do something

end

[/lua]

There might be possible to do something better though.

I think the way to go is to make your own function. I came up with this:

[lua]local function isInt(t, loc)

    for i = 1, #loc do

        t = t[loc[i]]

        if not t then return false end

    end

    if type(t) == “number” then

        return true

    end

    return false

end

if isInt(table, {3,2,3} then

    – do something

end

[/lua]

There might be possible to do something better though.