diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-30 21:36:22 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-30 21:36:22 +0000 |
commit | 5ca1049ab47f3f9ff9157f71af9072f04a637500 (patch) | |
tree | 24fcb14f2890900a4a709312ab25bfc2c14a3939 /src/tp.lua | |
parent | c23240726e3044e3eaa32a82a999b754c08bc183 (diff) | |
download | luasocket-5ca1049ab47f3f9ff9157f71af9072f04a637500.tar.gz luasocket-5ca1049ab47f3f9ff9157f71af9072f04a637500.tar.bz2 luasocket-5ca1049ab47f3f9ff9157f71af9072f04a637500.zip |
Fine tuning the "require" business.
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 |