diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 18:40:52 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 18:40:52 +0000 |
commit | 195069cf5f929f445b0ce20e531cd482d2559083 (patch) | |
tree | 6444d37c4ce32395428ba26ee0d16c0c372bd9da /src/auxiliar.c | |
parent | e63f500d24ff0238425c9e13f220daf09a277ef5 (diff) | |
download | luasocket-195069cf5f929f445b0ce20e531cd482d2559083.tar.gz luasocket-195069cf5f929f445b0ce20e531cd482d2559083.tar.bz2 luasocket-195069cf5f929f445b0ce20e531cd482d2559083.zip |
Fixed functions that return messages in ?socket.c.
Moved complexity of connect and accept there.
Created a new options.c module to take care of options.
Auxiliar.c is now cleaner.
Diffstat (limited to 'src/auxiliar.c')
-rw-r--r-- | src/auxiliar.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/src/auxiliar.c b/src/auxiliar.c index 4b3a0f6..6888f9c 100644 --- a/src/auxiliar.c +++ b/src/auxiliar.c | |||
@@ -66,26 +66,6 @@ int aux_checkboolean(lua_State *L, int objidx) | |||
66 | } | 66 | } |
67 | 67 | ||
68 | /*-------------------------------------------------------------------------*\ | 68 | /*-------------------------------------------------------------------------*\ |
69 | * Calls appropriate option handler | ||
70 | \*-------------------------------------------------------------------------*/ | ||
71 | int aux_meth_setoption(lua_State *L, luaL_reg *opt) | ||
72 | { | ||
73 | const char *name = luaL_checkstring(L, 2); /* obj, name, args */ | ||
74 | while (opt->name && strcmp(name, opt->name)) | ||
75 | opt++; | ||
76 | if (!opt->func) { | ||
77 | char msg[45]; | ||
78 | sprintf(msg, "unknown option `%.35s'", name); | ||
79 | luaL_argerror(L, 2, msg); | ||
80 | } | ||
81 | lua_remove(L, 2); /* obj, args */ | ||
82 | lua_pushcfunction(L, opt->func); /* obj, args, func */ | ||
83 | lua_insert(L, 1); /* func, obj, args */ | ||
84 | lua_call(L, lua_gettop(L)-1, LUA_MULTRET); | ||
85 | return lua_gettop(L); | ||
86 | } | ||
87 | |||
88 | /*-------------------------------------------------------------------------*\ | ||
89 | * Return userdata pointer if object belongs to a given class, abort with | 69 | * Return userdata pointer if object belongs to a given class, abort with |
90 | * error otherwise | 70 | * error otherwise |
91 | \*-------------------------------------------------------------------------*/ | 71 | \*-------------------------------------------------------------------------*/ |