Add basic lua 5.3 support

This commit is contained in:
Bart van Strien
2015-06-16 10:25:41 +02:00
parent df1bd42dec
commit 3cb777e2b7
39 changed files with 252 additions and 187 deletions
+10 -3
View File
@@ -15,6 +15,9 @@
#include "unix.h"
#include <sys/un.h>
extern void luax_register(lua_State *L, const char *name, const luaL_Reg *l);
extern int luax_c_insistglobal(lua_State *L, const char *k);
/*=========================================================================*\
* Internal function prototypes
\*=========================================================================*/
@@ -90,10 +93,14 @@ int luaopen_socket_unix(lua_State *L) {
auxiliar_add2group(L, "unix{client}", "unix{any}");
auxiliar_add2group(L, "unix{server}", "unix{any}");
/* make sure the function ends up in the package table */
luaL_openlib(L, "socket", func, 0);
/* return the function instead of the 'socket' table */
lua_pushcfunction(L, global_create);
luax_c_insistglobal(L, "socket");
lua_pushstring(L, "unix");
lua_gettable(L, -2);
lua_pushvalue(L, -3);
lua_settable(L, -3);
/* return the function instead of the 'socket' table */
return 1;
}