[Help] Lube networking

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
azin
Prole
Posts: 26
Joined: Sat Sep 12, 2009 9:39 pm

[Help] Lube networking

Post by azin »

I got lube networking working for me so far. i am currently having problems figuring out how to send data via TCP to player 1, 2, 3, and 4. server:send(data) doesn't even seem to send anything also.. and the data variable is not empty.

For example sending certain data only to player 1 like player 1's x/y position.
my server/main.lua:

Code: Select all

love.filesystem.load("lib/LUBE.lua")()
local Server = NetTest:addState('Server')
function Server:enterState()
  clearLoveCallbacks()
  x = 0
  print("initializing server")
  function onConnect(ip, port)
    print("Connection from " .. ip)
  end
  function onReceive(data, ip, port)
  x = tonumber(data)
  end
  function onDisconnect(ip, port)
    
  end
  server = lube.server(18025)
  server:setCallback(onReceive, onConnect, onDisconnect)
  server:setHandshake("Hi!")
  print("initialized server")
  
  function love.update(dt)
    server:update(dt)
  end
  function love.draw()
  love.graphics.print(x, 100, 85)
  end
  function love.keypressed(k)
    if k=='escape' then
      netTest:gotoState('Menu')
    end
  end
end
function Server:exitState()
  --TODO: Server EXIT CODE
  print("Exiting server")
end



Post Reply

Who is online

Users browsing this forum: Google [Bot], MaxChri and 2 guests