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

What is the easiest way to index a table?

Asked by 10 years ago

I believe to do it you use

table[index]

but I was wondering if there are other ways besides looping through the table?

2 answers

Log in to vote
0
Answered by
jobro13 980 Moderation Voter
10 years ago

You loop through a table if you don't know all indices.

For table indexing you generally use table[index]... this is also the "easiest" way.

0
I was curious as to whether or not you could do it without loops and indexing the table directly. TheGreatGardenGnome 25 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Honestly, my favorite indexing is table.index, but that only works with strings that doesn't start with numbers and has no spaces. Only when I have varying index I use the square brackets.

Answer this question