Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

connectedUsers

NicholasScott1337 edited this page Jul 18, 2015 · 4 revisions

Net:connectedUsers()

[SERVER FUNCTION ONLY]

Description
Call-Only
Gets all currently connected users in the database
Parameters

Nil

Returns
Table
All currently connected users
Table Format

Table is a table the server can store data in for a single client

local PlayerData = {}
   PlayerData.Ping = 74
   PlayerData.Color = 2
Player ID = Table
"31.204.45.16:17584" = PlayerData
Examples

Constantly kicks anyone who joins, every times love.update runs it kicks anyone in the server

function love.update()
   for id,data in pairs( Net:connectedUsers() ) do
      Net:kickUser( id, "Just Cause, That's why" )
   end
end

Sends the client his own table from the server, not really sure what this could be good for.. Maybe syncing data???

function love.update()
   for id,data in pairs( Net:connectedUsers() ) do
      Net:send( data, "syncData", nil, id )
   end
end