mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
Added lume.match()
This commit is contained in:
parent
dbd93b3861
commit
30991649f8
8
lume.lua
8
lume.lua
@ -201,6 +201,14 @@ function lume.find(t, value)
|
|||||||
end
|
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)
|
function lume.slice(t, i, j)
|
||||||
i = i and absindex(#t, i) or 1
|
i = i and absindex(#t, i) or 1
|
||||||
j = j and absindex(#t, j) or #t
|
j = j and absindex(#t, j) or #t
|
||||||
|
Loading…
Reference in New Issue
Block a user