A Concatenate Question

Hey,
I have the a table

tbl_Table[1].eng_letter_1 = ‘a’
tbl_Table[1].eng_letter_2 = ‘b’
tbl_Table[1].eng_letter_3 = ‘c’
tbl_Table[1].eng_letter_4 = ‘d’

How can I do the following
for k = 1,4 do
print (tbl_Table[1].eng_letter_…k)
end

My wish is to Print all 4 values but this is obviously wrong.
how can I concatenate the value of k to the table’s name?

Sorry for mentioning VBS but is there a lua equivalent to the vbs execute/Eval?

Thanks [import]uid: 43596 topic_id: 25546 reply_id: 325546[/import]

You could do it like this: (there are several ways you could accomplish this however

[code]

local tbl_Table = {}
tbl_Table[1] = {eng_letter = {‘a’, ‘b’, ‘c’, ‘d’} }

for k = 1, 4 do
print(tbl_Table[1].eng_letter[k])
end
[/code] [import]uid: 84637 topic_id: 25546 reply_id: 103272[/import]

Hey,
The solution above will not help me because I can’t change the table definition as it’s being sent to my function as a parameter and I don’t know I’m advance how many .eng_letter_[] I’ll end up with
tbl_Table[1].eng_letter_1 = ‘a’
tbl_Table[1].eng_letter_2 = ‘b’
tbl_Table[1].eng_letter_3 = ‘c’
tbl_Table[1].eng_letter_4 = ‘d’

tbl_Table[1].eng_letter_54 = ‘g’

So I can’t redefine my table but I need a way to extract what’s inside:
tbl_Table[1].eng_letter_[k]

How can I do the following
for k = 1,54 do
print (tbl_Table[1].eng_letter_…k)
end

Is there a way to concatenate the value of k to the table’s name?

Sorry for mentioning VBScript, but is there a lua equivalent to the vbs Execute/Eval? [import]uid: 43596 topic_id: 25546 reply_id: 103411[/import]