UDP and Modules

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.
Post Reply
User avatar
GhostAction
Prole
Posts: 34
Joined: Wed Apr 22, 2015 11:10 pm
Contact:

UDP and Modules

Post by GhostAction »

So I'm making a multiplayer games and I just started switching everything to modules, but I ran into one problem: How do I get UDP to work within modules? I tried looping it through all the functions, but it barely worked. Any ideas?
Attachments
void² server.lua
(2.59 KiB) Downloaded 87 times
void² v0.2.1.love
(7.01 KiB) Downloaded 91 times
Last edited by GhostAction on Mon May 16, 2016 10:22 pm, edited 1 time in total.
Owner of Isocubic. (Developer of void²)
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: UDP and Modules

Post by s-ol »

What? modules don't really change anything. You have some logical error somewhere in your architecture and we can't tell you what it is without you showing us your code.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
GhostAction
Prole
Posts: 34
Joined: Wed Apr 22, 2015 11:10 pm
Contact:

Re: UDP and Modules

Post by GhostAction »

Yeah I'll upload it one minute.
Owner of Isocubic. (Developer of void²)
User avatar
GhostAction
Prole
Posts: 34
Joined: Wed Apr 22, 2015 11:10 pm
Contact:

Re: UDP and Modules

Post by GhostAction »

Alright uploaded them. The code is a tad bit different from a couple days ago, but the multiplayer part should be the same.
Owner of Isocubic. (Developer of void²)
User avatar
pgimeno
Party member
Posts: 3637
Joined: Sun Oct 18, 2015 2:58 pm

Re: UDP and Modules

Post by pgimeno »

Not related to your problem, but...

Code: Select all

local playerColors = {blue = 91, 192, 235; yellow = 253, 231, 76; green = 155, 197, 61; red = 195, 66, 63}
I don't think this does what you think it does. It is equivalent to this:

Code: Select all

local playerColors = {blue=91, [1]=192, [2]=235, yellow=253, [3]=231, [4]=76, green=155, [5]=197, [6]=61; red=195, [7]=66, [8]=63}
i.e. 'blue' gets the number 91, 'yellow' the number 253, 'green' the number 155, 'red' the number 195, and the elements with numeric indices 1, 2, 3, 4, 5, 6, 7 and 8 get the values 192, 235, 231, 76, 197, 61, 66, and 63 respectively.

You probably meant something like this:

Code: Select all

local playerColors = {blue = {91, 192, 235}; yellow = {253, 231, 76}; green = {155, 197, 61}; red = {195, 66, 63}}
because then you can do this:

Code: Select all

love.graphics.setColor(playerColors.blue)
User avatar
GhostAction
Prole
Posts: 34
Joined: Wed Apr 22, 2015 11:10 pm
Contact:

Re: UDP and Modules

Post by GhostAction »

Yeah I know, I probably copied from some code that was from a month ago.
Owner of Isocubic. (Developer of void²)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Semrush [Bot] and 3 guests