aboutsummaryrefslogtreecommitdiff
path: root/src/tp.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-30 21:36:22 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-30 21:36:22 +0000
commit5ca1049ab47f3f9ff9157f71af9072f04a637500 (patch)
tree24fcb14f2890900a4a709312ab25bfc2c14a3939 /src/tp.lua
parentc23240726e3044e3eaa32a82a999b754c08bc183 (diff)
downloadluasocket-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.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tp.lua b/src/tp.lua
index b671e58..f510226 100644
--- a/src/tp.lua
+++ b/src/tp.lua
@@ -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
9if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end 9require("socket")
10-- get LuaSocket namespace 10-- get LuaSocket namespace
11local socket = _G[LUASOCKET_LIBNAME] 11local socket = _G[LUASOCKET_LIBNAME]
12if not socket then error('module requires LuaSocket') end 12
13-- create namespace inside LuaSocket namespace 13-- create namespace inside LuaSocket namespace
14socket.tp = socket.tp or {} 14socket.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
38print(reply)
38 return code, reply 39 return code, reply
39end 40end
40 41
@@ -58,6 +59,7 @@ function metat.__index:check(ok)
58end 59end
59 60
60function metat.__index:command(cmd, arg) 61function metat.__index:command(cmd, arg)
62print(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
63end 65end