Dividing numbers into multiple numerical variables

Hey
Here is another question for all the smart people out there.
I have a number “255” and I want to separate the numbers into two variables so “25” is in one variable and the last number “5” is in its own variable. I have tried using string.sub() but it outputs a string value. I need a numerical value that I can use as a vector in a mesh :-?
Maybe a way to make a string back to a numerical value?
Or there may be a fancy function that I have overlooked…

You can use tonumber to convert a string to a number

n = 255
m = n%10 -- m is now 5
l = math.floor(n/10) -- l is now 25

or

n=255
a,b=math.modf(n,10)
b=b*10

Or you can use string.sub by doing this:

n = 255
n=tostring(n)
a = tonumber(string.sub(n,1,2))
b = tonumber(string.sub(n,3,3))

It’s more intensive than Ignatz’ or LoopSpace’s code but only noticeable if used a lot.