Skip to content

Instantly share code, notes, and snippets.

@pawelz
Created February 13, 2010 16:32
Show Gist options
  • Save pawelz/303530 to your computer and use it in GitHub Desktop.
Save pawelz/303530 to your computer and use it in GitHub Desktop.
function clientfind (properties)
local clients = client.get()
local rv = nil
for i, c in pairs(clients) do
if match(properties, c) then
rv = c
end
end
return rv
end
-- Returns true if all pairs in table1 are present in table2
function match (table1, table2)
for k, v in pairs(table1) do
if table2[k] ~= v then
return false
end
end
return true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment