Files
soldr-modules/tests_framework/lua/cliargs/utils/lookup.lua
T
2022-11-22 02:21:28 +03:00

25 lines
494 B
Lua

-- Used internally to lookup an entry using either its short or expanded keys
local function lookup(k, ek, ...)
local _
for _, t in ipairs({...}) do
for _, entry in ipairs(t) do
if k and entry.key == k then
return entry
end
if ek and entry.expanded_key == ek then
return entry
end
if entry.negatable then
if ek and ("no-"..entry.expanded_key) == ek then return entry end
end
end
end
return nil
end
return lookup