53 lines
829 B
Text
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
|