view console.lua @ 9:129ac4eef472 default tip

Add comments to the code.
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sun, 07 Jun 2015 14:38:33 +0200
parents aac66151e58e
children
line wrap: on
line source

function lua_console(conn)
    function send_output(str)
        if (conn~=nil) then
            conn:send(str);
        end;
    end;
    node.output(send_output, 0);
    conn:on("receive", function (conn, pl) node.input(pl) end);
    conn:on("disconnection", function (conn) node.output(nil) end);
end;

function lua_init()
    while wifi.ap.getip() == '' do
        tmr.delay(50000);
        print("Waiting for IP...");
    end
    lua_server = net.createServer(net.TCP, 180);
    lua_server:listen(2323, lua_console);
end