lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The Copas documentation at:
http://www.keplerproject.org/copas/manual.html
needs a couple of small fixes.

function echoHandler(skt)
  while true                                      <- do is missing
    local data = copas.receive(skt)
    if data == "quit" then
      break
    end
    copas.send(skt, data)
  end
end

function echoHandler(skt)
  skt = copas.wrap(skt)
  while true                                      <- do is missing
    local data = skt:receive()
    if data == "quit" then
      break
    end
    skt:send(data)
  end
end

copas.addserver(server, EchoHandler)  <- should be echoHandler (lower case 'e')

After applying the fixes to the above examples, the code runs like a charm.

Would it make sense for copas.addserver to check that the 2nd argument
is a function?  (If the 2nd arg to copas.addserver is nil, the result
doesn't show up until one tries to connect to the running server, at
which time an error message is generated which gives no clue that the
problem is the nil argument value.)

Thanks for Copas.  It works extremely well.

Regards,
Bill Trenker