-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improved tests to handle more cases * Simplified generator assert generation * When a function fails on the server it will now output the error message * Event On now returns a disconnect function * Various fixes
- Loading branch information
Showing
9 changed files
with
171 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,4 @@ | |
/release | ||
/Network | ||
/Blink | ||
test/Client.luau | ||
test/Server.luau | ||
test/Sources/Game.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
local Shared = require("Shared") | ||
|
||
local Signal = Shared.Signal | ||
local ClientEnviornment = Shared.GetEnviornment() | ||
|
||
local function Clone(Source: buffer): buffer | ||
local Size = buffer.len(Source) | ||
local Target = buffer.create(Size) | ||
buffer.copy(Target, 0, Source, 0, Size) | ||
return Target | ||
end | ||
|
||
local function Fire(Reliable: boolean, ...) | ||
local Arguments = {...} | ||
local Buffer = #Arguments == 2 and Arguments[1] or Arguments[2] | ||
local Instances = Arguments[#Arguments] | ||
|
||
Buffer = Clone(Buffer) | ||
Instances = table.clone(Instances) | ||
|
||
Shared.Bridge:Fire("Client", Reliable and "BLINK_RELIABLE_REMOTE" or "BLINK_UNRELIABLE_REMOTE", Buffer, Instances) | ||
end | ||
|
||
ClientEnviornment.Instances.BLINK_RELIABLE_REMOTE = { | ||
FireServer = function(self, ...) | ||
Fire(true, ...) | ||
end, | ||
OnClientEvent = Signal.new() | ||
} | ||
|
||
ClientEnviornment.Instances.BLINK_UNRELIABLE_REMOTE = { | ||
FireServer = function(self, ...) | ||
Fire(false, ...) | ||
end, | ||
OnClientEvent = Signal.new() | ||
} | ||
|
||
Shared.Bridge:Connect(function(From: string, Remote: string, Buffer: buffer, Instances: {Instance}) | ||
if From == "Client" then | ||
return | ||
end | ||
|
||
ClientEnviornment.Instances[Remote].OnClientEvent:Fire(Buffer, Instances) | ||
end) | ||
|
||
return ClientEnviornment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
local Shared = require("Shared") | ||
|
||
local Signal = Shared.Signal | ||
local ServerEnviornment = Shared.GetEnviornment() | ||
|
||
local function Clone(Source: buffer): buffer | ||
local Size = buffer.len(Source) | ||
local Target = buffer.create(Size) | ||
buffer.copy(Target, 0, Source, 0, Size) | ||
return Target | ||
end | ||
|
||
local function Fire(Reliable: boolean, ...) | ||
local Arguments = {...} | ||
local Buffer = #Arguments == 2 and Arguments[1] or Arguments[2] | ||
local Instances = Arguments[#Arguments] | ||
|
||
Buffer = Clone(Buffer) | ||
Instances = table.clone(Instances) | ||
|
||
Shared.Bridge:Fire("Server", Reliable and "BLINK_RELIABLE_REMOTE" or "BLINK_UNRELIABLE_REMOTE", Buffer, Instances) | ||
end | ||
|
||
ServerEnviornment.Instances.BLINK_RELIABLE_REMOTE = { | ||
FireClient = function(self, Player, ...) | ||
Fire(true, ...) | ||
end, | ||
FireAllClients = function(self, ...) | ||
Fire(true, ...) | ||
end, | ||
OnServerEvent = Signal.new() | ||
} | ||
|
||
ServerEnviornment.Instances.BLINK_UNRELIABLE_REMOTE = { | ||
FireClient = function(Player, ...) | ||
Fire(false, ...) | ||
end, | ||
FireAllClients = function(self, ...) | ||
Fire(false, ...) | ||
end, | ||
OnServerEvent = Signal.new() | ||
} | ||
|
||
Shared.Bridge:Connect(function(From: string, Remote: string, Buffer: buffer, Instances: {Instance}) | ||
if From == "Server" then | ||
return | ||
end | ||
|
||
ServerEnviornment.Instances[Remote].OnServerEvent:Fire(Shared.Player, Buffer, Instances) | ||
end) | ||
|
||
return ServerEnviornment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.