Thank you InDieTasten! Your code works flawlessly :D/>
One question though,
in the line:
result = result..tostring(value%10)
Why do you have it be value modulo ten?
Shouldn't it just be value?
If you take the numbers 15 and 17, my function iterates, from least significant to most significant digit:
5+7 = 12
12 modulo 10 = 2 <- and the carry is 1
so the "current" digit in this iteration should just be 2, otherwise the string would grow too many characters. the carry of 1 just gets added to the next digit:
1+1+1 = 3
3 modulo 10 = 3 <- and the carry is 0
so the first iteration results in 2
the second iteration results in 3
together they become 23, and reversing it at the and will get the final answer: 32 = 15+17
Hope that helped somewhat.
In other terms, my value variable holds the sum of the digits from the numbers and the carry from the operation before.
My value is then devided into the actual digit at that position, and the leftover carry for the next iteration.
The choice to use modulo comes just, because it was the first thing that got in my mind when writing. you could also convert the value to string, and read out the first character for carry, and the second character for the actual digit for the final result.