MCPcopy Create free account
hub / github.com/apache/thrift / luaopen_libluasocket

Function luaopen_libluasocket

lib/lua/src/luasocket.c:175–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175int luaopen_libluasocket(lua_State *L) {
176 luaL_newmetatable(L, SOCKET_GENERIC);
177 luaL_newmetatable(L, SOCKET_CLIENT);
178 luaL_newmetatable(L, SOCKET_SERVER);
179 lua_pop(L, 3);
180 add_to_group(L, SOCKET_GENERIC, SOCKET_ANY);
181 add_to_group(L, SOCKET_CLIENT, SOCKET_ANY);
182 add_to_group(L, SOCKET_SERVER, SOCKET_ANY);
183 add_to_group(L, SOCKET_CLIENT, SOCKET_CONN);
184 add_to_group(L, SOCKET_SERVER, SOCKET_CONN);
185 set_methods(L, SOCKET_GENERIC, methods_generic);
186 set_methods(L, SOCKET_CLIENT, methods_client);
187 set_methods(L, SOCKET_SERVER, methods_server);
188#if LUA_VERSION_NUM >= 502
189 lua_newtable(L);
190 luaL_setfuncs(L, funcs_luasocket, 0);
191#else
192 luaL_register(L, "luasocket", funcs_luasocket);
193#endif
194 return 1;
195}
196
197////////////////////////////////////////////////////////////////////////////////
198// General

Callers

nothing calls this directly

Calls 2

add_to_groupFunction · 0.85
set_methodsFunction · 0.70

Tested by

no test coverage detected