From abecb5b718c08fe90f934922f672b4ff38e255a0 Mon Sep 17 00:00:00 2001 From: rxi Date: Sat, 7 Feb 2015 22:56:13 +0000 Subject: [PATCH] Updated README.md with new functions --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 3116071..97d34db 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,28 @@ lume.weightedchoice({ ["cat"] = 10, ["dog"] = 5, ["frog"] = 0 }) -- Returns either "cat" or "dog" with "cat" being twice as likely to be chosen. ``` +### lume.push(t, ...) +Pushes all the given values to the end of the table `t` and returns the values. +```lua +local t = { 1, 2, 3 } +lume.push(t, 4, 5) -- `t` becomes { 1, 2, 3, 4, 5 } +``` + +### lume.remove(t, x) +Removes the first instance of the value `x` if it exists in the table `t`. +Returns `x`. +```lua +local t = { 1, 2, 3 } +lume.remove(t, 2) -- `t` becomes { 1, 3 } +``` + +### lume.clear(t) +Nils all the values in the table `t`, this renders the table empty. +```lua +local t = { 1, 2, 3 } +lume.clear(t) -- `t` becomes {} +``` + ### lume.shuffle(t) Returns a shuffled copy of the array `t`.