mcbot/cmds/calc.lua
changeset 16 064a50911e05
parent 0 89add07d6fe4
--- a/mcbot/cmds/calc.lua	Thu Apr 15 18:35:13 2010 +0200
+++ b/mcbot/cmds/calc.lua	Thu Apr 15 18:57:38 2010 +0200
@@ -1,3 +1,6 @@
+
+local dc = { ["desc"] = "RPN calculator" }
+local calc = { ["desc"] = "Calculator" }
 
 local function sbox (untrusted_code)
     -- make environment
@@ -17,7 +20,7 @@
 
 -- ---- ----
 
-local function dc (args)
+function dc.cmd (args)
     if not args then return nil, "Give me an expression" end
     -- Downloaded from http://www.math.bas.bg/bantchev/place/rpn/rpn.lua.html
     tb = {}  z = 0
@@ -36,7 +39,7 @@
     elseif n>1 or z==nil then return nil, "dc: Error!" end
 end
 
-local function calc (args)
+function calc.cmd (args)
     if not args then return nil, "Give me an expression" end
     local f, msg = sbox("return "..args)
     if not f then