comparison ConsoleHandlers.lua @ 13:cc98f28b1c7c tip

remove geradd message fix issue with -- add support for console commands
author Jay Bird <a4blank@yahoo.com>
date Thu, 13 Jan 2011 20:50:34 +0300
parents
children
comparison
equal deleted inserted replaced
11:d2cbfe498c4d 13:cc98f28b1c7c
1
2 function RTT:HandleCommand(cmd)
3 local args = {}
4 for token in string.gmatch(cmd, "[^%s]+") do
5 table.insert(args, token)
6 end
7
8 local command = args[1]
9 local method = "Handle" .. command:sub(1, 1):upper() .. command:sub(2)
10 if RTT[method] == nil then
11 print("Unknown command " .. method)
12 return
13 end
14 RTT[method](self, args)
15 end
16
17 function RTT:HandleToggle()
18 end
19
20 function RTT:HandleShow()
21 self:ShowFrame()
22 end
23
24 function RTT:HandleHide()
25 self:HideFrame()
26 end
27
28 function RTT:HandleSave(args)
29 local name = args[2]
30 self:Save(name)
31 end
32
33 function RTT:HandleLoad(args)
34 local name = args[2]
35 self:Load(name)
36 end
37
38 function RTT:HandleDelete(args)
39 local name = args[2]
40 self.db.profile.setups[name] = nil
41 end
42
43
44 RTT:RegisterChatCommand("rtt", function(cmd) RTT:HandleCommand(cmd) end)