diff options
Diffstat (limited to 'challenge-091/paulo-custodio/lua/ch-1.lua')
| -rw-r--r-- | challenge-091/paulo-custodio/lua/ch-1.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/challenge-091/paulo-custodio/lua/ch-1.lua b/challenge-091/paulo-custodio/lua/ch-1.lua index 96270413e7..0a3bf830c3 100644 --- a/challenge-091/paulo-custodio/lua/ch-1.lua +++ b/challenge-091/paulo-custodio/lua/ch-1.lua @@ -14,14 +14,14 @@ results and show them. --]] function count_number(n) - local inp, out = tostring(n), '' - while (inp ~= '') do - local digit = string.match(inp, "^%d") - local digits = string.match(inp, "^"..digit.."+") - out = out..tostring(#digits)..digit - inp = string.sub(inp, #digits+1) - end - return out + local inp, out = tostring(n), '' + while (inp ~= '') do + local digit = string.match(inp, "^%d") + local digits = string.match(inp, "^"..digit.."+") + out = out..tostring(#digits)..digit + inp = string.sub(inp, #digits+1) + end + return out end print(count_number(tonumber(arg[1]))) |
