Nested Table issue

I haven’t done lua in a while and used to be able to do things like this easily. I am getting an attempt to index a nil value at line 10. Help is appreciated.



db = {}
db.weapons = {}
db.weapons.primary = {}
db.weapons.primary.team1 = {}
db.weapons.primary.team2 = {}
db.weapons.secondary = {}
db.weapons.secondary.team1 = {}
db.weapons.secondary.team2 = {}

*ERROR HERE*
db.weapons.primary.team1[0].name = "Light SMG"

db.weapons.primary.team1[0].wmodel = "models/weapons/w_smg1.mdl"
db.weapons.primary.team1[0].req = {"none"}

db.weapons.primary.team1[1].name = "M4A1 AR"
db.weapons.primary.team1[1].wmodel = "models/weapons/w_rif_m4a1.mdl"
db.weapons.primary.team1[1].req = {"firstone"}


Lua indexes start at 0.

And team[0] is not a table.

Lua indexes start at 1.

Meant to say does not start at 0, I didn’t check my post for mistakes.