CrosRoad95 Posted April 2, 2017 Share Posted April 2, 2017 function split should have parametr like "tryFormat" example result=split("mystring,123,mystring",",",true) -- true is "try format" result is table {"mystring",123,"mystring"} insted {"mystring","123","mystring"} Link to comment
MTA Team botder Posted April 5, 2017 MTA Team Share Posted April 5, 2017 function splitf(input, separator) local output = split(input, separator) for index = 1, #output do local fragment = output[index] if fragment:match("^%d") then output[index] = tonumber(fragment:match("^%d+%.?%d+")) end end return output end Example: output = {"Hello", "123", "World", "123prefix", "3.141wtf", "suffix456"} 1 Hello string 2 123 number 3 World string 4 123 number 5 3.141 number 6 suffix456 string Link to comment
Recommended Posts