PerEspen00 Posted May 4, 2017 Share Posted May 4, 2017 Hi! I'm using luaenet for my game and it's going well, but I can't seem to make a disconnect option. I don't know if I'm understanding it correctly or not, but I can't find an option where you can disconnect a host, or destroy one. So I'm looking for a way to disconnect a host. Website for the luaenet: http://leafo.net/lua-enet/#peerdisconnectdata Post I used to download: http://www.leadwerks.com/werkspace/topic/14699-networking-in-lua/#entry99965 Any help appreciated. Quote Link to comment Share on other sites More sharing options...
Crazycarpet Posted May 4, 2017 Share Posted May 4, 2017 I would imagine they have it configured to destroy the host using the the lua garbage collector.... What you can try doing is printing out the "enet" table and see if it has "enet.host_destroy" as that would follow the general style they're going for since the C++ version would be like: enet_host_destroy(components.host); If it's not there you could definitely expose it yourself (push it to "enet" module.) then manually handle deletion... or even not use lua-enet all together and generate your own bindings with toLua++ and a pkg generator like the one me or Josh released on here. (think would require adding //lua comments to the enet header files.) (Then you'd have to ensure you manually destroyed the host though, as it wouldn't be config'd to work w/ the GC.) But yeah if all references to the host become nil it should delete itself local host = enet.host_create"localhost:6789" host = nil -- the host will now be garbage collected. . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.