90 for k,v in pairs(item) do |
90 for k,v in pairs(item) do |
91 print(k,type(v) == "table" and table.concat(v, ", ") or v) |
91 print(k,type(v) == "table" and table.concat(v, ", ") or v) |
92 end |
92 end |
93 end; |
93 end; |
94 } |
94 } |
|
95 function commands.help () |
|
96 print("Roster commands"); |
|
97 for cmd in pairs(commands) do |
|
98 print(" * " .. cmd); |
|
99 end |
|
100 print("Most commands takes a JID as argument."); |
|
101 end |
95 local function on_incoming(stdin, text) |
102 local function on_incoming(stdin, text) |
96 local cmd = text:match("^(%a*)"); |
103 local cmd = text:match("^(%a*)"); |
97 local param = text:match("%s+(.*)", #cmd); |
104 local param = text:match("%s+(.*)", #cmd); |
98 if commands[cmd] then |
105 if commands[cmd] then |
99 commands[cmd](param); |
106 commands[cmd](param); |