The Lua tone function is good, but can only convert unsigned integers if they are not base 10. I have a situation where I have numbers like 01.4C that I would like to convert to decimal numbers.
I have a muddy solution:
function split(str, pat) local t = {} local fpat = "(.-)" .. pat local last_end = 1 local s, e, cap = str:find(fpat, 1) while s do if s ~= 1 or cap ~= "" then table.insert(t,cap) end last_end = e+1 s, e, cap = str:find(fpat, last_end) end if last_end <=
I would be interested to get a better solution for this, if any.
source share