mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 11:02:20 +00:00
Changed lume.fn/once's returned func return, v1.0.8
* The functions which lume.fn() and lume.once() return now return their inner functions' return value instead of nil * Moved lume.once() in lume.lua and README.md to be near its similar functions -- lume.fn() and lume.time()
This commit is contained in:
19
README.md
19
README.md
@@ -121,15 +121,6 @@ exist in the table.
|
||||
lume.find({"a", "b", "c"}, "b") -- Returns 2
|
||||
```
|
||||
|
||||
### lume.once(fn, ...)
|
||||
Returns a wrapper function to `fn` which takes the supplied arguments. The
|
||||
wrapper function will call `fn` on the first call and do nothing on any
|
||||
subsequent calls.
|
||||
```lua
|
||||
local f = lume.once(print, "Hello")
|
||||
f() -- Prints "Hello"
|
||||
f() -- Does nothing
|
||||
```
|
||||
|
||||
### lume.slice(t [, i [, j]])
|
||||
Mimics the behaviour of Lua's `string.sub`, but operates on an array rather
|
||||
@@ -149,6 +140,16 @@ local f = lume.fn(print, "Hello")
|
||||
f() -- Prints "Hello"
|
||||
```
|
||||
|
||||
### lume.once(fn, ...)
|
||||
Returns a wrapper function to `fn` which takes the supplied arguments. The
|
||||
wrapper function will call `fn` on the first call and do nothing on any
|
||||
subsequent calls.
|
||||
```lua
|
||||
local f = lume.once(print, "Hello")
|
||||
f() -- Prints "Hello"
|
||||
f() -- Does nothing
|
||||
```
|
||||
|
||||
### lume.time(fn, ...)
|
||||
Inserts the arguments into function `fn` and calls it. Returns the time in
|
||||
seconds the function `fn` took to execute followed by `fn`'s returned values.
|
||||
|
Reference in New Issue
Block a user