Pass command to the callback functions
Add mcbot_get_command_list() helper function
--- a/mcbot/mcbot_engine.lua Thu Apr 15 19:05:58 2010 +0200
+++ b/mcbot/mcbot_engine.lua Thu Apr 15 19:21:41 2010 +0200
@@ -17,6 +17,10 @@
commands[name] = object
end
+function mcbot_get_command_list ()
+ return commands
+end
+
require "cmds.wtf"
require "cmds.calc"
require "cmds.spell"
@@ -38,9 +42,10 @@
cmd, arg = line:match("^(%w+)%s+(.*)")
end
if cmd then
+ local lccmd = cmd:lower()
for name, obj in pairs(commands) do
- if cmd and cmd:lower() == name then
- return obj.cmd(arg, botdata)
+ if lccmd == name then
+ return obj.cmd(arg, botdata, cmd)
end
end
else