mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 11:02:20 +00:00
Added lume.match()
This commit is contained in:
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
|
||||||
|
Reference in New Issue
Block a user