Added lume.match()

This commit is contained in:
rxi 2014-04-04 18:08:39 +01:00
parent dbd93b3861
commit 30991649f8

View File

@ -201,6 +201,14 @@ function lume.find(t, value)
end
function lume.match(t, fn)
for k, v in pairs(t) do
if fn(v) then return v, k end
end
return nil
end
function lume.slice(t, i, j)
i = i and absindex(#t, i) or 1
j = j and absindex(#t, j) or #t