-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/
| 47 | * Initializes module |
| 48 | \*-------------------------------------------------------------------------*/ |
| 49 | LUASOCKET_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 |
nothing calls this directly
no test coverage detected