aboutsummaryrefslogtreecommitdiff
path: root/challenge-180/deadmarshal/lua/ch-2.lua
diff options
context:
space:
mode:
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)))