Editing Module:Test/lib/search
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 58: | Line 58: | ||
local condition = false | local condition = false | ||
− | if type(query) == | + | if type(query) == "string" or type(query) == "number" then |
condition = key == query | condition = key == query | ||
elseif query[1] and query[2] then | elseif query[1] and query[2] then | ||
Line 74: | Line 74: | ||
-- find first -- | -- find first -- | ||
---------------- | ---------------- | ||
− | |||
function search.find(query, tbl, parentKey) | function search.find(query, tbl, parentKey) | ||
local children = {} | local children = {} | ||
Line 93: | Line 92: | ||
if search.search_condition(query, k, v) then | if search.search_condition(query, k, v) then | ||
− | + | return quad | |
− | |||
elseif type(v) == "table" then | elseif type(v) == "table" then | ||
table.insert(children, k) | table.insert(children, k) |