Hello, I’ve been looking for ways to search through a table to find a value/index and return that table the value/index is in. How would I do that? Here is an example of what I mean…
local function recursive_find(t, key_to_find)
for key, value in pairs(t) do
if key == key_to_find then
return true
end
if typeof(value) == "table" then
return recursive_find(value, key_to_find)
end
end
return false
end
print(recursive_find({
dog = {
cat = {
puppy = {
kitten = { }
}
}
}
}, "kitten")) -- true