summaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_util.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua
index 2a2a80fc5..e8fbe2dee 100644
--- a/lualib/lua_util.lua
+++ b/lualib/lua_util.lua
@@ -46,7 +46,12 @@ local function rspamd_str_split(s, sep)
gr = split_grammar[sep]
if not gr then
- local _sep = lpeg.P(sep)
+ local _sep
+ if type(sep) == 'string' then
+ _sep = lpeg.S(sep) -- Assume set
+ else
+ _sep = sep -- Assume lpeg object
+ end
local elem = lpeg.C((1 - _sep)^0)
local p = lpeg.Ct(elem * (_sep * elem)^0)
gr = p