Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
Merge pull request #23 from SirWaddles/22-type-keyword
Browse files Browse the repository at this point in the history
type renamed to 'type_prm'
  • Loading branch information
JamesWilko committed Aug 21, 2015
2 parents 445e879 + 4772ed5 commit 9f1f80b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions mods/base/req/network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ end
function LNetwork:GetNameFromPeerID(id)

if managers.network and managers.network:session() and managers.network:session():peers() then

for k, v in pairs( managers.network:session():peers() ) do
if k == id then
return v:name()
Expand All @@ -73,7 +73,7 @@ function LNetwork:GetNameFromPeerID(id)
end

return "No Name"

end

function LNetwork:GetPeers()
Expand All @@ -88,24 +88,24 @@ function LNetwork:GetNumberOfPeers()
return i
end

function LNetwork:SendToPeers(type, data)
function LNetwork:SendToPeers(type_prm, data)
local dataString = LNetwork.AllPeersString
dataString = dataString:gsub("{1}", LNetwork.AllPeers)
dataString = dataString:gsub("{2}", type)
dataString = dataString:gsub("{2}", type_prm)
dataString = dataString:gsub("{3}", data)
LNetwork:SendStringThroughChat(dataString)
end

function LNetwork:SendToPeer(peer, type, data)
function LNetwork:SendToPeer(peer, type_prm, data)
local dataString = LNetwork.SinglePeerString
dataString = dataString:gsub("{1}", LNetwork.SinglePeer)
dataString = dataString:gsub("{2}", peer)
dataString = dataString:gsub("{3}", type)
dataString = dataString:gsub("{3}", type_prm)
dataString = dataString:gsub("{4}", data)
LNetwork:SendStringThroughChat(dataString)
end

function LNetwork:SendToPeersExcept(peer, type, data)
function LNetwork:SendToPeersExcept(peer, type_prm, data)
local dataString = LNetwork.ExceptPeerString
local peerStr = peer
if type(peer) == "table" then
Expand All @@ -120,7 +120,7 @@ function LNetwork:SendToPeersExcept(peer, type, data)

dataString = dataString:gsub("{1}", LNetwork.ExceptPeer)
dataString = dataString:gsub("{2}", peerStr)
dataString = dataString:gsub("{3}", type)
dataString = dataString:gsub("{3}", type_prm)
dataString = dataString:gsub("{4}", data)
LNetwork:SendStringThroughChat(dataString)
end
Expand Down Expand Up @@ -177,7 +177,7 @@ function LNetwork:ProcessChatString(sender, message, color, icon)
if msgType == LNetwork.ExceptPeer then
LNetwork:ProcessExceptPeer(sender, message, color, icon)
end

end

function LNetwork:ProcessAllPeers(sender, message, color, icon)
Expand All @@ -197,7 +197,7 @@ function LNetwork:ProcessSinglePeer(sender, message, color, icon)
end

function LNetwork:ProcessExceptPeer(sender, message, color, icon)

local splitData = string.split( message, LNetwork.Split )
local exceptedPeers = string.split( splitData[2], "[,]" )

Expand Down Expand Up @@ -231,7 +231,7 @@ function LNetwork:StringToColour(str)
if #data < 4 then
return nil
end

local split_str = "[:]"
local r = tonumber(string.split(data[1], split_str)[2])
local g = tonumber(string.split(data[2], split_str)[2])
Expand Down

0 comments on commit 9f1f80b

Please sign in to comment.