You can use the *n
read pattern if you're sure you're reading numbers.
If you read the file line by line as in your example code, then extract the words in the line using %S+
and convert them to numbers with tonumber
.
Bottom line: leave the heavy parsing to tonumber
.