working version of sumofints in Lua