# HG changeset patch # User Mikael Berthe # Date 1271352101 -7200 # Node ID 615c9b336207d1e411d0060ded58bbbadeabab5b # Parent d941ef833b4a6c84b59e8525f83aab8e55f20d1b Pass command to the callback functions Add mcbot_get_command_list() helper function diff -r d941ef833b4a -r 615c9b336207 mcbot/mcbot_engine.lua --- 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