diff options
| author | Jokler <jokler.contact@gmail.com> | 2018-02-17 23:25:38 +0100 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2018-02-17 23:25:38 +0100 |
| commit | 806614b5bf00581c9a564fcda4ecb760b6d27c6a (patch) | |
| tree | 06e07701e20a6ef2055cb4ea97a6c6258ae356c8 /src/plugins/factoids/sandbox.lua | |
| parent | 0892425bf833c03765e2edba8d6fdb338ae68ed5 (diff) | |
| download | frippy-806614b5bf00581c9a564fcda4ecb760b6d27c6a.tar.gz frippy-806614b5bf00581c9a564fcda4ecb760b6d27c6a.zip | |
Improve factoid error handling
Diffstat (limited to 'src/plugins/factoids/sandbox.lua')
| -rw-r--r-- | src/plugins/factoids/sandbox.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/factoids/sandbox.lua b/src/plugins/factoids/sandbox.lua index 282a903..8ebf518 100644 --- a/src/plugins/factoids/sandbox.lua +++ b/src/plugins/factoids/sandbox.lua @@ -1,5 +1,6 @@ function send(text) - len = #output + local text = tostring(text) + local len = #output if len < 1 then output = { text } else @@ -25,4 +26,9 @@ local env = { print = send, tostring = tostring, math = math } -load(factoid, nil, nil, env)() +local f, e = load(factoid, nil, nil, env) +if f then + f() +else + error(e) +end |
