author | Mikael Berthe <mikael@lilotux.net> |
Fri, 03 Apr 2015 22:49:15 +0200 | |
changeset 71 | 63ee968309d4 |
parent 66 | d9c00a9fe9d5 |
permissions | -rwxr-xr-x |
0 | 1 |
#! /usr/bin/env lua |
2 |
||
66
d9c00a9fe9d5
Add notices before public release
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
3 |
-- This is a small wrapper to call the mcabbot engine from a shell |
d9c00a9fe9d5
Add notices before public release
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
4 |
-- (i.e. without mcabber). |
d9c00a9fe9d5
Add notices before public release
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
5 |
|
0 | 6 |
require "mcbot_engine" |
7 |
||
8 |
local function mcbot_mainloop (BotName) |
|
1
cca972635e5e
Provid more data to the bot functions
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
9 |
local data = { ["nickname"] = BotName } |
0 | 10 |
while true do |
11 |
local l = io.stdin:read'*l' |
|
12 |
if l == nil then break end |
|
1
cca972635e5e
Provid more data to the bot functions
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
13 |
local res, errmsg = process(l, data, false) |
0 | 14 |
if res then |
15 |
print(res) |
|
16 |
else |
|
17 |
if errmsg then print(errmsg) end |
|
18 |
end |
|
19 |
end |
|
20 |
end |
|
21 |
||
22 |
mcbot_mainloop("mcbot") |