aboutsummaryrefslogtreecommitdiff
path: root/challenge-250/roger-bell-west/lua/ch-2.lua
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-250/roger-bell-west/lua/ch-2.lua')
-rwxr-xr-xchallenge-250/roger-bell-west/lua/ch-2.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/challenge-250/roger-bell-west/lua/ch-2.lua b/challenge-250/roger-bell-west/lua/ch-2.lua
new file mode 100755
index 0000000000..bb2ad72473
--- /dev/null
+++ b/challenge-250/roger-bell-west/lua/ch-2.lua
@@ -0,0 +1,28 @@
+#! /usr/bin/lua
+
+function alphanumericstringvalue(a)
+ local l = {}
+ for _i, n in ipairs(a) do
+ local p = tonumber(n)
+ if p == nil then
+ p = #n
+ end
+ table.insert(l, p)
+ end
+ return math.max(table.unpack(l))
+end
+
+if alphanumericstringvalue({"perl", "2", "000", "python", "raku"}) == 6 then
+ io.write("Pass")
+else
+ io.write("FAIL")
+end
+io.write(" ")
+
+if alphanumericstringvalue({"001", "1", "000", "0001"}) == 1 then
+ io.write("Pass")
+else
+ io.write("FAIL")
+end
+print("")
+