libs/core: Fixed luci.util.split
This commit is contained in:
parent
8579f2d8c7
commit
2edc50aa43
1 changed files with 5 additions and 1 deletions
|
@ -186,8 +186,12 @@ function split(str, pat, max, regex)
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
local s, e = str:find(pat, c, not regex)
|
local s, e = str:find(pat, c, not regex)
|
||||||
table.insert(t, str:sub(c, s and s - 1))
|
|
||||||
max = max - 1
|
max = max - 1
|
||||||
|
if s and max < 0 then
|
||||||
|
table.insert(t, str:sub(c))
|
||||||
|
else
|
||||||
|
table.insert(t, str:sub(c, s and s - 1))
|
||||||
|
end
|
||||||
c = e and e + 1 or #str + 1
|
c = e and e + 1 or #str + 1
|
||||||
until not s or max < 0
|
until not s or max < 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue