mcbot/mcbot_shell.lua
changeset 1 cca972635e5e
parent 0 89add07d6fe4
child 66 d9c00a9fe9d5
equal deleted inserted replaced
0:89add07d6fe4 1:cca972635e5e
     1 #! /usr/bin/env lua
     1 #! /usr/bin/env lua
     2 
     2 
     3 require "mcbot_engine"
     3 require "mcbot_engine"
     4 
     4 
     5 local function mcbot_mainloop (BotName)
     5 local function mcbot_mainloop (BotName)
       
     6     local data = { ["nickname"] = BotName }
     6     while true do
     7     while true do
     7         local l = io.stdin:read'*l'
     8         local l = io.stdin:read'*l'
     8         if l == nil then break end
     9         if l == nil then break end
     9         local res, errmsg = process(l, BotName, false)
    10         local res, errmsg = process(l, data, false)
    10         if res then
    11         if res then
    11             print(res)
    12             print(res)
    12         else
    13         else
    13             if errmsg then print(errmsg) end
    14             if errmsg then print(errmsg) end
    14         end
    15         end