Lua has a very small number of 'types', instead of arrays and structures and records, like other languages, Lua only has lists.
A list is sort of like a hash if you are familiar with those, you have a key and a value, so for example:
alist ={a = 1, 2 = "hello", 'T' = {another list}}
is a perfectly valid list.
Prompt(alist.2) would result in hello
pairs is how you iterate through a list so for k,v in pairs(alist) would give
a, 1
2, hello
T, <list pointer>
If all you want to do is find out the keys for a list for k,_ pairs(alist) would just give those (like in the soldier example, just using a list to find out the entity numbers for all the soldiers).
You will see a lot of scripts just using lists as if they are arrays, this is fine if you know what you are doing but it is always best to remember they are certainly not arrays!
if you say alist={"one","two","three"."four","five","six"} (maybe for a dice game?), the interpreter will insert keys for you, so alist[1] will result in the value "one" etc, but you could quite validly now do alist['rubbish'] = 42 and as you can appreciate your nice array picture goes out of the window!
Lua is extremely powerful and flexible, I've spent 40 years coding in over 50 different languages and this baby is by far my favourite so far.
Been there, done that, got all the T-Shirts!