UDP Networking [Solved]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
antivapor
Prole
Posts: 5
Joined: Mon Oct 01, 2012 8:44 pm
Location: erf
Contact:

Re: UDP Networking

Post by antivapor »

Quick question regarding versions of Lua and LuaSocket and it being bundled with Love. Running `lua server.lua` of course returns an error because I haven't installed LuaSocket yet. Since LuaSocket is bundled with Love, am I able to just link to that? And which version is it? I'm currently browsing about my filesystem but can't find the Linux-path to bundled components.

I've got both Lua5.1 and 5.2. LuaSocket 2.0.2 says it is compatible with Lua 5.1 (Src Mirror), and whatever bundled version is compatible with 5.2. Also, has anyone used LuaSocket 3.0? I'm going to try with that first.

Looking forward to playing the KarmaExchange example, I read through it and just need to get the server going :3.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: UDP Networking

Post by bartbes »

It's completely built into the engine, starting from 0.9.0 you could probably get it by loading liblove.
User avatar
spynaz
Party member
Posts: 152
Joined: Thu Feb 28, 2013 5:49 am

Re: UDP Networking

Post by spynaz »

bartbes wrote:It's completely built into the engine, starting from 0.9.0 you could probably get it by loading liblove.
Ok, so how would you run server.lua that doesn't use the LOVE framework?
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 2:04 am, edited 1 time in total.
User avatar
spynaz
Party member
Posts: 152
Joined: Thu Feb 28, 2013 5:49 am

Re: UDP Networking

Post by spynaz »

bekey wrote:Is this a viable solution? http://www.exitgames.com/
I'm not hosting an online server. I just need to know how I would run the server.lua if it doesn't use the LOVE framework.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: UDP Networking

Post by josefnpat »

mH38GZl.png
mH38GZl.png (9.7 KiB) Viewed 337 times
So long as you have luasocket2 installed, you can write a server in pure Lua.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
spynaz
Party member
Posts: 152
Joined: Thu Feb 28, 2013 5:49 am

Re: UDP Networking

Post by spynaz »

josefnpat wrote:Image

So long as you have luasocket2 installed, you can write a server in pure Lua.
Ok. But what if I want the user to create the server with a click of a button. How would you run the file from LOVE? Just require it?
User avatar
antivapor
Prole
Posts: 5
Joined: Mon Oct 01, 2012 8:44 pm
Location: erf
Contact:

Re: UDP Networking

Post by antivapor »

spynaz wrote:
josefnpat wrote:Image

So long as you have luasocket2 installed, you can write a server in pure Lua.
Ok. But what if I want the user to create the server with a click of a button. How would you run the file from LOVE? Just require it?
For a push of a button, I think you only have to put a `require("server") in your main.lua, comment out `serverSetup()` at the bottom of server.lua, and make a button call to `serverSetup()`.

And related to my question, at the moment, I've got LuaSocket3.0 running with Lua5.1, and'll post my solution when I get it working with 5.2. :)
bartbes wrote:It's completely built into the engine, starting from 0.9.0 you could probably get it by loading liblove.
How is liblove called, or where is it located? Is it just a folder when I upgrade from 0.8.0 to 0.9.0?

Also, thanks Germanunkol for the Karma example, it was really helpful.
User avatar
spynaz
Party member
Posts: 152
Joined: Thu Feb 28, 2013 5:49 am

Re: UDP Networking

Post by spynaz »

antivapor wrote:
spynaz wrote:
josefnpat wrote:Image

So long as you have luasocket2 installed, you can write a server in pure Lua.
Ok. But what if I want the user to create the server with a click of a button. How would you run the file from LOVE? Just require it?
For a push of a button, I think you only have to put a `require("server") in your main.lua, comment out `serverSetup()` at the bottom of server.lua, and make a button call to `serverSetup()`.

And related to my question, at the moment, I've got LuaSocket3.0 running with Lua5.1, and'll post my solution when I get it working with 5.2. :)
bartbes wrote:It's completely built into the engine, starting from 0.9.0 you could probably get it by loading liblove.
How is liblove called, or where is it located? Is it just a folder when I upgrade from 0.8.0 to 0.9.0?

Also, thanks Germanunkol for the Karma example, it was really helpful.
Ok, I see now. Thanks for you help.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: UDP Networking

Post by bartbes »

antivapor wrote: How is liblove called, or where is it located?
Linux: $libdir/liblove.so, defaulting to $prefix/lib/liblove.so defaulting to /usr/lib/liblove.so for packages and /usr/local/lib/liblove.so for source builds.
Windows: love.dll (or liblove.dll, I always forget)
OSX: .. wherever you put libraries..

I'd like to mention that, considering your use case, it might be interesting to, instead of running your server separately, running it inside of a thread. That way you do have access to love's luasocket, the server will quit when the game quits, and it's still isolated.

@spynaz: Could you please stop quoting entire posts? It's in violation of the etiquette.
Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot], slime and 84 guests