From a219aca07f9dc753aa3c48317ed8bc41c2df4625 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Thu, 5 Mar 2015 21:15:02 +0100 Subject: [PATCH] export 2 compiletime constants. Fixes #129 --- src/select.c | 3 +++ src/udp.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/select.c b/src/select.c index fafaa62..da5e37e 100644 --- a/src/select.c +++ b/src/select.c @@ -40,6 +40,9 @@ int select_open(lua_State *L) { lua_pushstring(L, "_SETSIZE"); lua_pushnumber(L, FD_SETSIZE); lua_rawset(L, -3); + lua_pushstring(L, "_SOCKETINVALID"); // for use with getfd() and setfd() + lua_pushnumber(L, SOCKET_INVALID); + lua_rawset(L, -3); #if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE) luaL_setfuncs(L, func, 0); #else diff --git a/src/udp.c b/src/udp.c index 12e320a..a6ddf2f 100644 --- a/src/udp.c +++ b/src/udp.c @@ -120,6 +120,9 @@ int udp_open(lua_State *L) auxiliar_add2group(L, "udp{connected}", "select{able}"); auxiliar_add2group(L, "udp{unconnected}", "select{able}"); /* define library functions */ + lua_pushstring(L, "_UDPDATAGRAMSIZE"); // max send/receive size + lua_pushnumber(L, UDP_DATAGRAMSIZE); + lua_rawset(L, -3); #if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE) luaL_setfuncs(L, func, 0); #else