MCPcopy Create free account
hub / github.com/Tencent/UnLua / base_open

Function base_open

Plugins/UnLuaExtensions/LuaSocket/Source/src/luasocket.cpp:74–94  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Setup basic stuff. \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

72* Setup basic stuff.
73\*-------------------------------------------------------------------------*/
74static int base_open(lua_State *L) {
75 if (socket_open()) {
76 /* export functions (and leave namespace table on top of stack) */
77 lua_newtable(L);
78 luaL_setfuncs(L, func, 0);
79#ifdef LUASOCKET_DEBUG
80 lua_pushstring(L, "_DEBUG");
81 lua_pushboolean(L, 1);
82 lua_rawset(L, -3);
83#endif
84 /* make version string available to scripts */
85 lua_pushstring(L, "_VERSION");
86 lua_pushstring(L, LUASOCKET_VERSION);
87 lua_rawset(L, -3);
88 return 1;
89 } else {
90 lua_pushstring(L, "unable to initialize library");
91 lua_error(L);
92 return 0;
93 }
94}
95
96/*-------------------------------------------------------------------------*\
97* Initializes all library modules.

Callers 1

luaopen_socket_coreFunction · 0.85

Calls 6

luaL_setfuncsFunction · 0.85
lua_pushstringFunction · 0.85
lua_pushbooleanFunction · 0.85
lua_rawsetFunction · 0.85
lua_errorFunction · 0.85
socket_openFunction · 0.70

Tested by

no test coverage detected