diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2014-12-11 21:03:53 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2014-12-11 21:03:53 +0100 |
commit | 281539cf53b8ec43d72e06cbdba874b2de6e758d (patch) | |
tree | 9dc539f574e424247458beade553cdffbed59707 /lualibs-util-tab.lua | |
parent | ee53358e267a7946608e66775047085b815b8608 (diff) | |
download | lualibs-281539cf53b8ec43d72e06cbdba874b2de6e758d.tar.gz |
sync with Context as of 2014-12-11
Diffstat (limited to 'lualibs-util-tab.lua')
-rw-r--r-- | lualibs-util-tab.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lualibs-util-tab.lua b/lualibs-util-tab.lua index f9e9b31..077c906 100644 --- a/lualibs-util-tab.lua +++ b/lualibs-util-tab.lua @@ -98,6 +98,17 @@ function tables.removevalue(t,value) -- todo: n end end +function tables.replacevalue(t,oldvalue,newvalue) + if oldvalue and newvalue then + for i=1,#t do + if t[i] == oldvalue then + t[i] = newvalue + -- replace all, so no: return + end + end + end +end + function tables.insertbeforevalue(t,value,extra) for i=1,#t do if t[i] == extra then |