View Single Post
02-11-24, 10:46 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,892
Lua Code:
  1. local vendors = {
  2.     [Tuukanit] = {Distilled Fish Juice, Improvised Sushi},
  3.     [Elder Nappa] = {Distilled Fish Juice, Improvised Sushi}
  4. }

Each key should be a string and each entry table (optional for the last) needs a comma at the end:

Lua Code:
  1. local vendors = {
  2.     ["Tuukanit"] = { ["Distilled Fish Juice"] = true, ["Improvised Sushi"] = true, },
  3.     ["Elder Nappa"] = { ["Distilled Fish Juice"] = true, ["Improvised Sushi"] = true, },
  4.     ["Fred Vendor"] = { ["Distilled Fish Juice"] = true, ["Improvised Sushi"] = true, },
  5.     ["Samantha Goods"] = { ["Distilled Fish Juice"] = true, ["Improvised Sushi"] = true, },
  6.     ["Trade Ya]" = { ["Distilled Fish Juice"] = true, ["Improvised Sushi"] = true, },
  7. }
if you just added the item string into the table as values it would be created as a number ordered table eg.

Lua Code:
  1. local vendors = {
  2.     ["Tuukanit"] = { "Distilled Fish Juice", "Improvised Sushi"], },
  3.     ["Elder Nappa"] = { "Distilled Fish Juice", "Improvised Sushi", },
  4.     ["Fred Vendor"] = { "Distilled Fish Juice", "Improvised Sushi", },
  5.     ["Samantha Goods"] = { "Distilled Fish Juice", "Improvised Sushi", },
  6.     ["Trade Ya]" = { "Distilled Fish Juice", "Improvised Sushi", },
  7. }

is the same as:

Lua Code:
  1. local vendors = {
  2.     ["Tuukanit"] = { [1] = "Distilled Fish Juice", [2] = "Improvised Sushi"], },
  3.     ["Elder Nappa"] = { [1] = "Distilled Fish Juice", [2] = "Improvised Sushi", },
  4.     ["Fred Vendor"] = { [1] = "Distilled Fish Juice", [2] = "Improvised Sushi", },
  5.     ["Samantha Goods"] = { [1] = "Distilled Fish Juice", [2] = "Improvised Sushi", },
  6.     ["Trade Ya]" = { [1] = "Distilled Fish Juice", [2] = "Improvised Sushi", },
  7. }
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-11-24 at 01:34 PM.
  Reply With Quote