#How to split a string to its numbers

1 messages · Page 1 of 1 (latest)

zealous mango
#

Hey, how can i split for example "12s" to 12 as a number? I only know i will use string.split

ruby bloom
#

local splitted = string.split("12s", "s");
will return an array that will look like this:

{

[1] = "12";
[2] = "";

};

so you just try to get the number from the first index

local Number = tonumber(splitted[1])

if not Number ...

torn sand
#

string.gsub, string.sub, string.match, string.gmatch, there are many ways