diff options
Diffstat (limited to 'src/tp.lua')
| -rw-r--r-- | src/tp.lua | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -6,10 +6,10 @@ | |||
| 6 | -- RCS ID: $Id$ | 6 | -- RCS ID: $Id$ |
| 7 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
| 8 | -- make sure LuaSocket is loaded | 8 | -- make sure LuaSocket is loaded |
| 9 | if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end | 9 | require("socket") |
| 10 | -- get LuaSocket namespace | 10 | -- get LuaSocket namespace |
| 11 | local socket = _G[LUASOCKET_LIBNAME] | 11 | local socket = _G[LUASOCKET_LIBNAME] |
| 12 | if not socket then error('module requires LuaSocket') end | 12 | |
| 13 | -- create namespace inside LuaSocket namespace | 13 | -- create namespace inside LuaSocket namespace |
| 14 | socket.tp = socket.tp or {} | 14 | socket.tp = socket.tp or {} |
| 15 | -- make all module globals fall into namespace | 15 | -- make all module globals fall into namespace |
| @@ -35,6 +35,7 @@ local function get_reply(control) | |||
| 35 | -- reply ends with same code | 35 | -- reply ends with same code |
| 36 | until code == current and sep == " " | 36 | until code == current and sep == " " |
| 37 | end | 37 | end |
| 38 | print(reply) | ||
| 38 | return code, reply | 39 | return code, reply |
| 39 | end | 40 | end |
| 40 | 41 | ||
| @@ -58,6 +59,7 @@ function metat.__index:check(ok) | |||
| 58 | end | 59 | end |
| 59 | 60 | ||
| 60 | function metat.__index:command(cmd, arg) | 61 | function metat.__index:command(cmd, arg) |
| 62 | print(cmd, arg) | ||
| 61 | if arg then return self.control:send(cmd .. " " .. arg.. "\r\n") | 63 | if arg then return self.control:send(cmd .. " " .. arg.. "\r\n") |
| 62 | else return self.control:send(cmd .. "\r\n") end | 64 | else return self.control:send(cmd .. "\r\n") end |
| 63 | end | 65 | end |
