Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I get the other values of a multidimensional array?

Asked by 2 years ago

I am trying to get the Level Name and Level Status but I haven't found out how to get those with just the level id (ex. "Level1" or index [1] of the 2nd array). Does anybody know how to do this?

local Levels = {
    {"Level0","Level 0","Safe"},
    {"Level1","Level 1","Unsafe"},
}

1 answer

Log in to vote
1
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
2 years ago

Multi-dimensional arrays are just arrays of arrays.

Indexing the 2nd element will provide you with an array, which you may index as well:

print(Levels[2][1]) --> "Level1"
Ad

Answer this question