aboutsummaryrefslogtreecommitdiff
path: root/challenge-180/deadmarshal/lua/ch-2.lua
diff options
context:
space:
mode:
authordeadmarshal <adeadmarshal@gmail.com>2022-09-02 11:13:08 +0430
committerdeadmarshal <adeadmarshal@gmail.com>2022-09-02 11:13:08 +0430
commit29b273fc146113e127bd1664dd8d198d4ad2dcbd (patch)
tree53f3b22f0d6b2cf4efd2b55b9104874d3485b2aa /challenge-180/deadmarshal/lua/ch-2.lua
parentd1d8886281c19a0f6119fea49e2f3a9a1b068a89 (diff)
downloadperlweeklychallenge-club-29b273fc146113e127bd1664dd8d198d4ad2dcbd.tar.gz
perlweeklychallenge-club-29b273fc146113e127bd1664dd8d198d4ad2dcbd.tar.bz2
perlweeklychallenge-club-29b273fc146113e127bd1664dd8d198d4ad2dcbd.zip
challenge180
Diffstat (limited to 'challenge-180/deadmarshal/lua/ch-2.lua')
-rw-r--r--challenge-180/deadmarshal/lua/ch-2.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-180/deadmarshal/lua/ch-2.lua b/challenge-180/deadmarshal/lua/ch-2.lua
new file mode 100644
index 0000000000..1cdd6f045a
--- /dev/null
+++ b/challenge-180/deadmarshal/lua/ch-2.lua
@@ -0,0 +1,13 @@
+local function trim_list(t, i)
+ assert(type(t) == 'table', 't must be a table!')
+ local filtered = {}
+ for j=1, #t do
+ if(t[j] > i) then table.insert(filtered, t[j]) end
+ end
+ return filtered
+end
+
+local n,i = {1,4,2,3,5}, 3
+local n2,i2 = {9,0,6,2,3,8,5}, 4
+print(table.unpack(trim_list(n,i)))
+print(table.unpack(trim_list(n2,i2)))