Answers for "Lua how to get the index of a nested table"

Lua
0

Lua how to get the index of a nested table

function findTL(tbl)
    for key, data in pairs(tbl) do
       if data.tl == tlSearch then 
          return key
       end
    end
end

local key = findTL(objects, 22)
Posted by: Guest on June-10-2020

Browse Popular Code Answers by Language