diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2022-09-02 11:08:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-02 11:08:44 +0100 |
| commit | 8162d93f3469587093f2c5a0d6e8cbdef9434e47 (patch) | |
| tree | be5db0f4e83e316b47fbcc702ebfa6979e8d395d /challenge-180/deadmarshal/lua/ch-2.lua | |
| parent | 91d665102ab1b10f30b41bcf87195be8565053ae (diff) | |
| parent | 29b273fc146113e127bd1664dd8d198d4ad2dcbd (diff) | |
| download | perlweeklychallenge-club-8162d93f3469587093f2c5a0d6e8cbdef9434e47.tar.gz perlweeklychallenge-club-8162d93f3469587093f2c5a0d6e8cbdef9434e47.tar.bz2 perlweeklychallenge-club-8162d93f3469587093f2c5a0d6e8cbdef9434e47.zip | |
Merge pull request #6683 from deadmarshal/challenge180
challenge180
Diffstat (limited to 'challenge-180/deadmarshal/lua/ch-2.lua')
| -rw-r--r-- | challenge-180/deadmarshal/lua/ch-2.lua | 13 |
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))) |
