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

Function luaopen_socket_unix

Plugins/UnLuaExtensions/LuaSocket/Source/src/unix.cpp:49–71  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

47* Initializes module
48\*-------------------------------------------------------------------------*/
49LUASOCKET_API int luaopen_socket_unix(lua_State *L)
50{
51 int i;
52 lua_newtable(L);
53 int socket_unix_table = lua_gettop(L);
54
55 for (i = 0; mod[i].name; i++)
56 mod[i].func(L);
57
58 /* Add backwards compatibility aliases "tcp" and "udp" for the "stream" and
59 * "dgram" functions. */
60 add_alias(L, socket_unix_table, "tcp", "stream");
61 add_alias(L, socket_unix_table, "udp", "dgram");
62
63 /* Add a backwards compatibility function and a metatable setup to call it
64 * for the old socket.unix() interface. */
65 lua_pushcfunction(L, compat_socket_unix_call);
66 lua_setfield(L, socket_unix_table, "__call");
67 lua_pushvalue(L, socket_unix_table);
68 lua_setmetatable(L, socket_unix_table);
69
70 return 1;
71}
72
73#endif

Callers

nothing calls this directly

Calls 5

lua_gettopFunction · 0.85
add_aliasFunction · 0.85
lua_setfieldFunction · 0.85
lua_pushvalueFunction · 0.85
lua_setmetatableFunction · 0.85

Tested by

no test coverage detected