--Greets the user that just connected, greets her again if she says "hello". --Says "Yeah, bye!" if she says bye and closes connection with her. return { connect = function (self, host, port) ret = self.super:connect(host, port) self.super:send "Hello there!\n" return ret end, recv = function (self) local line, err = self.super:recv() if line == nil then return line, err end if line:lower():find "hello" then self.send "Yeah, hi!\n" end if line:lower():find "bye" then self.send "Yeah, bye!\n" self.close() end return line end, }