diff options
Diffstat (limited to 'src/shared/lua_api/load_net.cpp')
| -rw-r--r-- | src/shared/lua_api/load_net.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/shared/lua_api/load_net.cpp b/src/shared/lua_api/load_net.cpp index cc2db02..4baf952 100644 --- a/src/shared/lua_api/load_net.cpp +++ b/src/shared/lua_api/load_net.cpp @@ -201,6 +201,13 @@ int lstream_writedouble(lua_State* L){ return 0; } +/*** +Get the pipe from this stream. +Gets the pipe from this stream, using the return value can be used with setpipe() +later to identify clients of a PAIR pipe +@function stream:getpipe() +@treturn pipe The pipe connected to the associated stream +*/ //stream:getpipe() :: pipe int lstream_getpipe(lua_State* L){ lua_getfield(L,-1,"data");//{stream},ud_stream @@ -212,6 +219,12 @@ int lstream_getpipe(lua_State* L){ return 1; } +/*** +Sets the pipe for the stream. +Sets the pipe for the stream, so that content is delivered to a specific client. +@function stream:setpipe() +@tparam pipe pipe The pipe for the specific client, gotten with stream:getpipe() +*/ //stream:setpipe(pipe) int lstream_setpipe(lua_State* L){ lua_getfield(L,-1,"pipe");//{stream},{pipe},ud_pipe @@ -300,8 +313,8 @@ void gameloop_net(lua_State* L){ luaL_getmetatable(L,"net.stream");//func,{data=stream} lua_setmetatable(L,-2);//func,{stream} lua_call(L,1,0);// - printf("Finished calling gameloop\n"); - nng_free(buf,size); + __mingw_printf("Finished calling gameloop, buf is %p, size is %zu\n",buf,size); + nng_msg_free(msgp); printf("called nn_freemsg\n"); free(stream);//We manually set stream->data so free_stream would crash here printf("Called free on stream\n"); |
