From 4f9fd9389eff4cbc446ff859049df8f2a0b1862c Mon Sep 17 00:00:00 2001 From: Akamaru Date: Tue, 14 Apr 2015 22:20:26 +0200 Subject: [PATCH] Added rechner plugin --- plugins/rechner.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/rechner.lua diff --git a/plugins/rechner.lua b/plugins/rechner.lua new file mode 100644 index 0000000..67f9812 --- /dev/null +++ b/plugins/rechner.lua @@ -0,0 +1,14 @@ +function run(msg, matches) + -- Convert expression to a function and execute it + local expression = string.gsub(matches[1], "(%a+)", "math.%1") + return load('return '..expression)() +end + +return { + description = "Ein simpler Taschenrechner", + usage = "/calc [Rechnung]", + patterns = { + "^/calc (.*)$" + }, + run = run +} \ No newline at end of file