Add input type check to split

This commit is contained in:
Alfredo Cardigliano 2022-08-31 10:58:27 +02:00
parent 3881dd3eea
commit ae04b11250

View file

@ -557,6 +557,15 @@ function split(pString, pPattern)
local Table = {} -- NOTE: use {n = 0} in Lua-5.0
local fpat = "(.-)" .. pPattern
local last_end = 1
-- input check
if pString == nil then
return Table
end
if type(pString) ~= "string" then
pString = tostring(pString)
end
local s, e, cap = pString:find(fpat, 1)
while s do
if s ~= 1 or cap ~= "" then