From 1a087efe99224c5d53c9f7bb50ced3937601f79e Mon Sep 17 00:00:00 2001 From: rxi Date: Fri, 4 Apr 2014 18:21:21 +0100 Subject: [PATCH] Added lume.match() to README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 98e805e..b195215 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,13 @@ exist in the table. lume.find({"a", "b", "c"}, "b") -- Returns 2 ``` +### lume.match(t, fn) +Returns the value and key of the value in table `t` which returns true when +`fn` is called on it. Returns `nil` if no such value exists. +```lua +lume.match({1, 5, 8, 7}, function(x) return x % 2 == 0 end) -- Returns 8, 3 +``` + ### lume.slice(t [, i [, j]]) Mimics the behaviour of Lua's `string.sub`, but operates on an array rather than a string. Creates and returns a new array of the given slice.