author | Mikael Berthe <mikael@lilotux.net> |
Sun, 11 Apr 2010 22:03:12 +0200 | |
changeset 1 | cca972635e5e |
parent 0 | 89add07d6fe4 |
child 66 | d9c00a9fe9d5 |
permissions | -rwxr-xr-x |
0 | 1 |
#! /usr/bin/env lua |
2 |
||
3 |
require "mcbot_engine" |
|
4 |
||
5 |
local function mcbot_mainloop (BotName) |
|
1
cca972635e5e
Provid more data to the bot functions
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
6 |
local data = { ["nickname"] = BotName } |
0 | 7 |
while true do |
8 |
local l = io.stdin:read'*l' |
|
9 |
if l == nil then break end |
|
1
cca972635e5e
Provid more data to the bot functions
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
10 |
local res, errmsg = process(l, data, false) |
0 | 11 |
if res then |
12 |
print(res) |
|
13 |
else |
|
14 |
if errmsg then print(errmsg) end |
|
15 |
end |
|
16 |
end |
|
17 |
end |
|
18 |
||
19 |
mcbot_mainloop("mcbot") |