diff options
Diffstat (limited to 'challenge-240/deadmarshal/lua/ch-1.lua')
| -rw-r--r-- | challenge-240/deadmarshal/lua/ch-1.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/challenge-240/deadmarshal/lua/ch-1.lua b/challenge-240/deadmarshal/lua/ch-1.lua new file mode 100644 index 0000000000..ee4ca54726 --- /dev/null +++ b/challenge-240/deadmarshal/lua/ch-1.lua @@ -0,0 +1,14 @@ +#!/usr/bin/env lua + +local function acronym(t,check) + assert(type(t) == 'table' and type(check) == 'string', + 't,check must be a table and a string respectively!') + local str_table = {} + for i=1,#t do table.insert(str_table,t[i]:sub(1,1):lower()) end + return table.concat(str_table) == check +end + +print(acronym({'Perl', 'Python', 'Pascal'},'ppp')) +print(acronym({'Perl', 'Raku'},'rp')) +print(acronym({'Oracle', 'Awk', 'C'},'oac')) + |
