KOKC, далеко не лучший вариант функции, но и все же
function str_explode(div,str,pos1,pos2,clear)
local t={}
local cpt,pos
if pos1==nil then pos1=1 end
if pos2==nil then pos2=pos1 end
local cpt1=string.find(str,div,pos1,true)
local cpt2=string.find(str,div,pos2,true)
if cpt1 and cpt2 then
if cpt2-cpt1>5 then
cpt=cpt1
pos=pos1
else
cpt=cpt2
pos=pos2
end
repeat
if clear then
table.insert(t,trim(string.sub(str,1,cpt-1)))
else
table.insert(t,string.sub(str,1,cpt-1))
end
str=string.sub(str,cpt+string.len(div))
cpt=string.find(str,div,pos,true)
until cpt==nil
end
if clear then
table.insert(t,trim(str))
else
table.insert(t,str)
end
return t
end