This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
FREAX/etc/lib/search
2022-07-18 19:33:40 +02:00

53 lines
829 B
Text

function traverseKey(array, text)
for k,v in pairs(array) do
if v == text then
return true, k
end
end
return false, nil
end
function traverseValue(array, text)
for k,v in pairs(array) do
if k == text then
return true, v
end
end
return false, nil
end
function findKey(array, text)
for k,v in pairs(array) do
if k == text then
return true, k
end
end
return false, nil
end
function findValue(array, text)
for k,v in pairs(array) do
if v == text then
return true, v
end
end
return false, nil
end
function queryForKey(array, text)
for k,v in pairs(array) do
if string.find(k, text) then
return true, k
end
end
return false, nil
end
function queryForValue(array, text)
for k,v in pairs(array) do
if string.find(v, text) then
return true, v
end
end
return false, nil
end