I have five tables (slots). For some reason, I can't loop through all fives tables and change their values.
Table:
CurrentFluff = {
CurrentFluff1 = { --Sets Current Fluff Variables
BodyType = (""),
BodyColor = (""),
FluffDescription = (""),
FluffName = (""),
FluffGender = ("")
},
CurrentFluff2 = { --Sets Current Fluff Variables
BodyType = (""),
BodyColor = (""),
FluffDescription = (""),
FluffName = (""),
FluffGender = ("")
},
CurrentFluff3 = { --Sets Current Fluff Variables
BodyType = (""),
BodyColor = (""),
FluffDescription = (""),
FluffName = (""),
FluffGender = ("")
},
CurrentFluff4 = { --Sets Current Fluff Variables
BodyType = (""),
BodyColor = (""),
FluffDescription = (""),
FluffName = (""),
FluffGender = ("")
},
CurrentFluff5 = { --Sets Current Fluff Variables
BodyType = (""),
BodyColor = (""),
FluffDescription = (""),
FluffName = (""),
FluffGender = ("")
}
}
For some reason, I can't loop through the tables, so I have to resort to this disgusting mess. This mess below still works.
if CurrentFluff.CurrentFluff1.FluffName == "" then
CurrentFluff.CurrentFluff1.BodyType = NewFluff.BodyType
CurrentFluff.CurrentFluff1.BodyColor = NewFluff.BodyColor
CurrentFluff.CurrentFluff1.FluffDescription = NewFluff.FluffDescription
CurrentFluff.CurrentFluff1.FluffName = NewFluff.FluffName
CurrentFluff.CurrentFluff1.FluffGender = NewFluff.FluffGender
elseif CurrentFluff.CurrentFluff2.FluffName == "" then
CurrentFluff.CurrentFluff2.BodyType = NewFluff.BodyType
CurrentFluff.CurrentFluff2.BodyColor = NewFluff.BodyColor
CurrentFluff.CurrentFluff2.FluffDescription = NewFluff.FluffDescription
CurrentFluff.CurrentFluff2.FluffName = NewFluff.FluffName
CurrentFluff.CurrentFluff2.FluffGender = NewFluff.FluffGender
elseif CurrentFluff.CurrentFluff3.FluffName == "" then
CurrentFluff.CurrentFluff3.BodyType = NewFluff.BodyType
CurrentFluff.CurrentFluff3.BodyColor = NewFluff.BodyColor
CurrentFluff.CurrentFluff3.FluffDescription = NewFluff.FluffDescription
CurrentFluff.CurrentFluff3.FluffName = NewFluff.FluffName
CurrentFluff.CurrentFluff3.FluffGender = NewFluff.FluffGender
elseif CurrentFluff.CurrentFluff4.FluffName == "" then
CurrentFluff.CurrentFluff4.BodyType = NewFluff.BodyType
CurrentFluff.CurrentFluff4.BodyColor = NewFluff.BodyColor
CurrentFluff.CurrentFluff4.FluffDescription = NewFluff.FluffDescription
CurrentFluff.CurrentFluff4.FluffName = NewFluff.FluffName
CurrentFluff.CurrentFluff4.FluffGender = NewFluff.FluffGender
elseif CurrentFluff.CurrentFluff5.FluffName == "" then
CurrentFluff.CurrentFluff5.BodyType = NewFluff.BodyType
CurrentFluff.CurrentFluff5.BodyColor = NewFluff.BodyColor
CurrentFluff.CurrentFluff5.FluffDescription = NewFluff.FluffDescription
CurrentFluff.CurrentFluff5.FluffName = NewFluff.FluffName
CurrentFluff.CurrentFluff5.FluffGender = NewFluff.FluffGender
end

1 comment
Thanks, I thought I had to use ipairs.