Added function lume.extend(), updated README and tests

This commit is contained in:
rxi
2015-05-05 19:21:56 +01:00
parent fce4a5e5df
commit 2e00c753d8
3 changed files with 32 additions and 0 deletions

View File

@@ -98,6 +98,15 @@ local t = { 1, 2, 3 }
lume.clear(t) -- `t` becomes {}
```
### lume.extend(t, ...)
Copies all the fields from the source tables to the table `t` and returns `t`.
Tables are iterated in order, so the right-most table overrides existing
fields.
```
local t = { a = 1, b = 2 }
lume.extend(t, { b = 4, c = 6 }) -- `t` becomes { a = 1, b = 4, c = 6 }
```
### lume.shuffle(t)
Returns a shuffled copy of the array `t`.