diff options
author | Steven Barth <steven@midlink.org> | 2008-07-05 16:27:24 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-07-05 16:27:24 +0000 |
commit | 2edc50aa4398d83d761fe67d7681d0316c457127 (patch) | |
tree | 6ab3d9e6c6a5ccc6c51b29a79170c5391688dbc3 /libs/core | |
parent | 8579f2d8c7a490eff33fbe225a63e00c28ed8854 (diff) |
libs/core: Fixed luci.util.split
Diffstat (limited to 'libs/core')
-rw-r--r-- | libs/core/luasrc/util.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index 76e382b45..443d5f303 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -186,8 +186,12 @@ function split(str, pat, max, regex) repeat local s, e = str:find(pat, c, not regex) - table.insert(t, str:sub(c, s and s - 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 until not s or max < 0 |