Giving a weapon from a table

Hi
In shared.lua I have


duelWeaponss = { "Sword", "Machete", "Revolver", "Fists" } --The nice-looking name of each weapon.

duelClassess = {}
duelClassess[1] = "m9k_damascus"
duelClassess[2] = "m9k_machete"
duelClassess[3] = "fas2_ragingbull"
duelClassess[4] = "weapon_fists"

in init.lua I have



dueler1:Give( duelClassess.duelWeppNum )
dueler2:Give( duelClassess.duelWeppNum )

(duelers are the two players that I wnat to give weapons to. I know that that part works)

duelWeppNum is the number given from a DListView, sent over from clientside. However, this code is breaking the entire addon, and not giving the weapon. What am I doing wrong?
Is there a way to check for a certain string in a table, and get the index of that string? Then use that index for another table to give the player the actual weapon?

-snip-
Misunderstood

The “.” Is used on tables when whatever follows it is a string key. So “tbl.yes” is equal to “tbl[‘yes]’ = whatever”. It does not work with integer keys as your “duelClasses” consist of. So change “duelClasses.duelWeppNum” to “duelClasses[duelWeppNum]”

Actually it’s tbl[‘yes’] not tbl[‘yes]’