aboutsummaryrefslogtreecommitdiff
path: root/src/luasocket.c
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2003-06-26 18:47:49 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2003-06-26 18:47:49 +0000
commit71f6bb60bf2b7457091c7106190f92ab7e51f7c6 (patch)
tree8ad3668667bd3da3c34f7ff7ae0a9a7a4daa4679 /src/luasocket.c
parentf330540576031528f0daac231c61d4dd06e8ba1e (diff)
downloadluasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.gz
luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.bz2
luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.zip
Finished implementation of LuaSocket 2.0 alpha on Linux.
Some testing still needed.
Diffstat (limited to 'src/luasocket.c')
-rw-r--r--src/luasocket.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/luasocket.c b/src/luasocket.c
index 5541d7f..96deac1 100644
--- a/src/luasocket.c
+++ b/src/luasocket.c
@@ -1,4 +1,5 @@
1/*=========================================================================*\ 1/*=========================================================================*\
2* LuaSocket toolkit
2* Networking support for the Lua language 3* Networking support for the Lua language
3* Diego Nehab 4* Diego Nehab
4* 26/11/1999 5* 26/11/1999
@@ -7,7 +8,7 @@
7* connectivity of the Lua language. The Lua interface to networking 8* connectivity of the Lua language. The Lua interface to networking
8* functions follows the Sockets API closely, trying to simplify all tasks 9* functions follows the Sockets API closely, trying to simplify all tasks
9* involved in setting up both client and server connections. The provided 10* involved in setting up both client and server connections. The provided
10* IO routines, however, follow the Lua style, being very similar to the 11* IO routines, however, follow the Lua style, being very similar to the
11* standard Lua read and write functions. 12* standard Lua read and write functions.
12* 13*
13* RCS ID: $Id$ 14* RCS ID: $Id$
@@ -24,6 +25,7 @@
24\*=========================================================================*/ 25\*=========================================================================*/
25#include "luasocket.h" 26#include "luasocket.h"
26 27
28#include "auxiliar.h"
27#include "timeout.h" 29#include "timeout.h"
28#include "buffer.h" 30#include "buffer.h"
29#include "socket.h" 31#include "socket.h"
@@ -38,23 +40,11 @@
38/*-------------------------------------------------------------------------*\ 40/*-------------------------------------------------------------------------*\
39* Initializes all library modules. 41* Initializes all library modules.
40\*-------------------------------------------------------------------------*/ 42\*-------------------------------------------------------------------------*/
41LUASOCKET_API int luaopen_socketlib(lua_State *L) 43LUASOCKET_API int luaopen_socket(lua_State *L)
42{ 44{
43 if (!sock_open()) return 0; 45 if (!sock_open()) return 0;
44 /* create namespace table */
45 lua_pushstring(L, LUASOCKET_LIBNAME);
46 lua_newtable(L);
47#ifdef LUASOCKET_DEBUG
48 lua_pushstring(L, "debug");
49 lua_pushnumber(L, 1);
50 lua_settable(L, -3);
51#endif
52 lua_settable(L, LUA_GLOBALSINDEX);
53 /* make sure modules know what is our namespace */
54 lua_pushstring(L, "LUASOCKET_LIBNAME");
55 lua_pushstring(L, LUASOCKET_LIBNAME);
56 lua_settable(L, LUA_GLOBALSINDEX);
57 /* initialize all modules */ 46 /* initialize all modules */
47 aux_open(L);
58 tm_open(L); 48 tm_open(L);
59 buf_open(L); 49 buf_open(L);
60 inet_open(L); 50 inet_open(L);