-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23c38df
commit ffd21a7
Showing
26 changed files
with
411 additions
and
212 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local ComplexEvent = require(ReplicatedStorage.ComplexEvent):Client() | ||
local SimpleEvent = require(ReplicatedStorage.SimpleEvent):Client() | ||
local EmptyEvent = require(ReplicatedStorage.EmptyEvent):Client() | ||
local ReadyEvent = require(ReplicatedStorage.ReadyEvent):Client() | ||
|
||
print("Registering Listeners") | ||
ComplexEvent:On(function(Value1, Value2, Value3) | ||
print("ComplexEvent", Value1, Value2, Value3) | ||
end) | ||
|
||
SimpleEvent:On(function(Value) | ||
print("SimpleEvent", Value) | ||
end) | ||
|
||
EmptyEvent:On(function() | ||
print("EmptyEvent") | ||
end) | ||
|
||
print("Firing Events") | ||
ComplexEvent:Fire({ one = { "String Literal", 123 }, two = { 123, "String Literal" } }, "hello world again", 123) | ||
SimpleEvent:Fire(123) | ||
EmptyEvent:Fire() | ||
|
||
task.wait(1) | ||
|
||
print("Firing Ready") | ||
ReadyEvent:Fire() |
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,56 @@ | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local ComplexEvent = require(ReplicatedStorage.ComplexEvent):Server() | ||
local SimpleEvent = require(ReplicatedStorage.SimpleEvent):Server() | ||
local EmptyEvent = require(ReplicatedStorage.EmptyEvent):Server() | ||
local ReadyEvent = require(ReplicatedStorage.ReadyEvent):Server() | ||
|
||
print("Registering Listeners") | ||
ComplexEvent:On(function(Player, Value1, Value2, Value3) | ||
print("ComplexEvent", Player, Value1, Value2, Value3) | ||
end) | ||
|
||
SimpleEvent:On(function(Player, Value) | ||
print("SimpleEvent", Player, Value) | ||
end) | ||
|
||
EmptyEvent:On(function(Player) | ||
print("EmptyEvent", Player) | ||
end) | ||
|
||
ReadyEvent:On(function(Player) | ||
print(`[{Player.Name}] Ready, firing events!`) | ||
|
||
print(`[{Player.Name}] :Fire`) | ||
SimpleEvent:Fire(Player, 1) | ||
EmptyEvent:Fire(Player) | ||
ComplexEvent:Fire(Player, nil, "hello world again", 1) | ||
|
||
print(`[{Player.Name}] :FireAll`) | ||
SimpleEvent:FireAll(2) | ||
EmptyEvent:FireAll() | ||
ComplexEvent:FireAll({ one = { "String Literal", 123 }, two = { 123, "String Literal" } }, "hello world again", 2) | ||
|
||
print(`[{Player.Name}] :FireAllExcept`) | ||
SimpleEvent:FireAllExcept(Player, 3) | ||
EmptyEvent:FireAllExcept(Player) | ||
ComplexEvent:FireAllExcept(Player, nil, "this should be skipped", 3) | ||
|
||
print(`[{Player.Name}] :FireList`) | ||
SimpleEvent:FireList({ Player }, 4) | ||
EmptyEvent:FireList({ Player }) | ||
ComplexEvent:FireList({ Player }, { one = { "String Literal", 8 }, two = { 1, "String Literal" } }, "hi", 4) | ||
|
||
print(`[{Player.Name}] :FireWithFilter`) | ||
SimpleEvent:FireWithFilter(function(OtherPlayer) | ||
return OtherPlayer.Name == Player.Name | ||
end, 5) | ||
EmptyEvent:FireWithFilter(function(OtherPlayer) | ||
return OtherPlayer.Name == Player.Name | ||
end) | ||
ComplexEvent:FireWithFilter(function(OtherPlayer) | ||
return OtherPlayer.Name == Player.Name | ||
end, { one = { "String Literal", 17 }, two = { 123, "String Literal" } }, "another string", 5) | ||
|
||
print(`[{Player.Name}] Done!`) | ||
end) |
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,11 @@ | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Red = require(ReplicatedStorage.Packages.Red) | ||
local Guard = require(ReplicatedStorage.Packages.Guard) | ||
|
||
local ValueCheck = | ||
Guard.Optional(Guard.Map(Guard.String, Guard.List(Guard.Or(Guard.Literal("String Literal"), Guard.Number)))) | ||
|
||
return Red.Event("ComplexEvent", function(Value1, Value2, Value3) | ||
return ValueCheck(Value1), Guard.String(Value2), Guard.Number(Value3) | ||
end) |
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,7 @@ | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Red = require(ReplicatedStorage.Packages.Red) | ||
|
||
return Red.Event("EmptyEvent", function() | ||
return | ||
end) |
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,7 @@ | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Red = require(ReplicatedStorage.Packages.Red) | ||
|
||
return Red.Event("ReadyEvent", function() | ||
return | ||
end) |
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,8 @@ | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Red = require(ReplicatedStorage.Packages.Red) | ||
local Guard = require(ReplicatedStorage.Packages.Guard) | ||
|
||
return Red.Event("SimpleEvent", function(Value) | ||
return Guard.Number(Value) | ||
end) |
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 |
---|---|---|
@@ -1,9 +1,23 @@ | ||
{ | ||
"name": "RedDev", | ||
"tree": { | ||
"$path": "Packages", | ||
"Red": { | ||
"$path": "lib" | ||
"$className": "DataModel", | ||
"ServerScriptService": { | ||
"$path": "Test/Server" | ||
}, | ||
"ReplicatedStorage": { | ||
"$path": "Test/Shared", | ||
"Packages": { | ||
"$path": "Packages", | ||
"Red": { | ||
"$path": "lib" | ||
} | ||
} | ||
}, | ||
"StarterPlayer": { | ||
"StarterPlayerScripts": { | ||
"$path": "Test/Client" | ||
} | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ Red is available for Rojo-based workflows and Studio workflows through wally. | |
|
||
```toml | ||
[dependencies] | ||
Red = "red-blox/[email protected]-rc.8" | ||
Red = "red-blox/[email protected]" | ||
``` | ||
|
||
3. Run `wally install` to install packages. | ||
|
@@ -23,7 +23,7 @@ Red = "red-blox/[email protected]" | |
return { | ||
studioWallyServer = "https://studio-wally.fewkz.com", | ||
packages = { | ||
Red = "red-blox/[email protected]-rc.8" | ||
Red = "red-blox/[email protected]" | ||
} | ||
} | ||
``` | ||
|
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,16 @@ | ||
# Redblox | ||
|
||
The Redblox project contains the library Red, but also other useful libraries. | ||
|
||
- [Red](https://red.redblox.dev/) - A simple, fast, and powerful networking library. | ||
- [Util](https://util.redblox.dev/) - A collection of small utilities for roblox. | ||
- [Bin](https://util.redblox.dev/bin) - Manages cleanup for objects that cannot be garbage collected. | ||
- [Clock](https://util.redblox.dev/clock) - Calls a function at consistent intervals. | ||
- [Collection](https://util.redblox.dev/collection) - Handles instance addition and removal from collections. | ||
- [Fetch](https://util.redblox.dev/fetch) - A Future based HTTP request utility similar to Javascript's fetch. | ||
- [Future](https://util.redblox.dev/future) - A lightweight class to represent asynchronous functions. | ||
- [Guard](https://util.redblox.dev/guard) - A runtime type checker with support for luau types. | ||
- [Promise](https://util.redblox.dev/promise) - A Promise implementation that prioritizes speed and ease of use. | ||
- [Ratelimit](https://util.redblox.dev/ratelimit) - Ratelimits many keys in a very intuitive interface. | ||
- [Signal](https://util.redblox.dev/signal) - A signal implementation without connection objects. | ||
- [Spawn](https://util.redblox.dev/spawn) - A shared "fast spawn" function that reuses threads. |
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.