sockets? - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: sockets? (/thread-28.html) |
sockets? - Dys0n - 02-28-2011 Im currently devloping a plugin to connect to a socket server i just wanted to know if there is a socket module or would i have to use luasockets dll? RE: sockets? - Jockie - 02-28-2011 The engine of MCServer is not LUA, so you have to use Java, I think. o.O RE: sockets? - Tybor - 02-28-2011 (02-28-2011, 01:56 AM)Jockie Wrote: The engine of MCServer is not LUA, so you have to use Java, I think. o.O I think he wants the plugin to gather some data from the server. You would need a lua module included by MCServer for this to work, or I think loading the luasockets module from within lua. greets, Tybor RE: sockets? - FakeTruth - 02-28-2011 I already created something for this, and exported it to Lua Code: class cTCPLink It's not documented anywhere. You basically need to 'extend' it like you extend cPlugin. You need this piece of code for that: Code: local TCPLink = {} Then you can inherit the ReceivedData function like so: Code: TCPLink:ReceivedData( Data, Size ) RE: sockets? - Dys0n - 02-28-2011 Okay im a tad confused as i only ever use pure lua and gmod lua, So what exactly do i need to do with this code? RE: sockets? - FakeTruth - 02-28-2011 Here's an example: Code: local TCPLink = {} RE: sockets? - Dys0n - 02-28-2011 Thanks dude, i can now start working on my plugin. RE: sockets? - Dys0n - 02-28-2011 On trying your example it crashes after data is recevied, Any ideas? |