update eval, pattern escape function
This commit is contained in:
parent
8f538ba65a
commit
6add3f5e6b
2 changed files with 8 additions and 2 deletions
|
@ -39,11 +39,13 @@ return {
|
|||
api = owner and C.api or nil,
|
||||
}
|
||||
for k,v in pairs(env) do t[k] = v end
|
||||
local e, err = load(C.api.unparseArgs(msg.args), 'eval', 't', t)
|
||||
local e, err = load(C.api.unparseArgs(msg.args), 'eval', 'bt', t)
|
||||
xpcall(function()
|
||||
if err then error(err) end
|
||||
e = tostring(e() or '...')
|
||||
end, function(err) e = err end)
|
||||
C.api:send(msg, s .. '\n' .. e)
|
||||
s = s ..'\n'.. e
|
||||
s = s:gsub(C.api.token:escp(), '<TOKEN>')
|
||||
C.api:reply(msg, s)
|
||||
end
|
||||
}
|
||||
|
|
|
@ -21,6 +21,10 @@ function table.findV(t, w)
|
|||
end
|
||||
end
|
||||
|
||||
function string.escp(s)
|
||||
return s:gsub('[%^%$%%%(%)%.%[%]%*%+%-%?]', '%%%0')
|
||||
end
|
||||
|
||||
function dump(t, d)
|
||||
if not tonumber(d) or d < 0 then d = 0 end
|
||||
local c = ''
|
||||
|
|
Loading…
Reference in a new issue