View Single Post
05-30-23, 03:16 PM   #4
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 322
When I want to search recursively for strings in tables, I use this function:

Lua Code:
  1. local function PrintTable(t, indent)
  2.   assert(type(t) == "table", "PrintTable() called for non-table!")
  3.  
  4.   local indentString = ""
  5.   for i = 1, indent do
  6.     indentString = indentString .. "  "
  7.   end
  8.  
  9.   for k, v in pairs(t) do
  10.     if type(v) ~= "table" then
  11.       if type(v) == "string" then
  12.         print(indentString, k, "=", v)
  13.       end
  14.     else
  15.       print(indentString, k, "=")
  16.       print(indentString, "  {")
  17.       PrintTable(v, indent + 2)
  18.       print(indentString, "  }")
  19.     end
  20.   end
  21. end
  22.  
  23. PrintTable(tableToPrint, 1)
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote