I'm new to using Lua, I'm used to Vbscript. The change seems to be a pretty big jump and I'm having a couple issues mainly with using the tables values and keys correctly. I'm trying to use nested tables and call only certain values to make a listbox. This is a simple version of my tables.
What I want the listbox to do is display the options as the keys from the the sub-tables pots.healpots and pots.spellpots with the value of their quantity keys added to the end. The only way I can figure out how to get it to display the keys I want is to combine the sub-tables but that jumbles an already cluttered plugin and would prefer not to, and I cannot figure out how to get it to add the values without receiving errors. That I'm pretty sure just come from my ineptitude with Lua. This is just a small part of a complex plugin and seems to be the main problem I'm having.
potsamnts = { healpots = 4, spellpots = 5}
pots = {
healpots = { jade = { name = "jade", quantity = 1}, ballad = { name = "ballad" ,quantity = 3}},
spellpots = { tea = { name = "tea", quantity = 3}, tears = { name = "tears", quantity = 2}},
}
What I want the listbox to do is display the options as the keys from the the sub-tables pots.healpots and pots.spellpots with the value of their quantity keys added to the end. The only way I can figure out how to get it to display the keys I want is to combine the sub-tables but that jumbles an already cluttered plugin and would prefer not to, and I cannot figure out how to get it to add the values without receiving errors. That I'm pretty sure just come from my ineptitude with Lua. This is just a small part of a complex plugin and seems to be the main problem I'm having.