The best way to print just numbers is to use either tonumber() or type().
Example:
(Using tonumber())
09 | for i,v in pairs (_table) do |
What the above does is this:
tonumber is a function that converts strings to numbers; if it can .
By using an if statement, I am testing whether or not the conversion went through. If it did, the statement will be true, and it will print the number; if not, the value will not print.
Note: if you call this function while the value is a number (like, try to convert a number to a number), it will still return true; and the number will print.
(Using type())
09 | for i,v in pairs (_table) do |
10 | if type (v) = = "number" then |
What the above does is this:
type is a function that returns the type of value the argument is. If the argument is "gorilla", then it will return string; however, if the argument is 1, then it will return number.
type cannot determine, though, the difference between 1 and "1" (the number one and a stringified one) considering the stringified one is a string.
I am using the if statement to ensure that the returned type, is a number. If it is, the statement is true, and the number is printed, if not, then the for loop "skips" (iterates) again.
Resources:
tonumber()
type()