View Single Post
12/16/23, 11:42 AM   #5
FlatBadger
 
FlatBadger's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2021
Posts: 17
You need to iterate the table, but it depends on the structure of your table. You need to use either
Lua Code:
  1. pairs
or
Lua Code:
  1. ipairs

e.g.

Lua Code:
  1. local myTable = {[key1]="value1",[key2]=value2}
  2.  
  3. for key, value in pairs(myTable) do
  4.  d("key: " .. key .. " value: " .. value)
  5.  
  6. end
  7.  
  8. local myOtherTable ={value1, value2, value3}
  9.  
  10. for index, value in ipairs(myOtherTable) do
  11.   d("item number " .. index .. " = " .. value)
  12. end

instead of ipairs you could also use:

Lua Code:
  1. for index = 1, #myOtherTable do
  2.   d("value = " .. myOtherTable[index])
  3. end

Last edited by FlatBadger : 12/16/23 at 12:15 PM.
  Reply With Quote