Add strsplit lua helper

This commit is contained in:
2025-03-27 19:56:31 +01:00
parent d9f54a8354
commit da93770334

View File

@@ -314,6 +314,18 @@ function upper(s) return string.upper(s) end
function lower(s) return string.lower(s) end
function format(s, ...) return string.format(s, ...) end
-- String split helper
function strsplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t = {}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
-- String to number conversion helper
function num(str)
return tonumber(str) or 0