Skip to content

Commit

Permalink
v1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
imezx committed Jan 30, 2024
1 parent c12356a commit b5b64c3
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 17 deletions.
Binary file modified Warp.rbxm
Binary file not shown.
Binary file modified WarpPlayground.rbxl
Binary file not shown.
4 changes: 4 additions & 0 deletions src/Index/Client/ClientProcess.luau
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--!native
--!strict
local ClientProcess = {}

Expand All @@ -18,6 +19,9 @@ local clientRequestQueue: Type.QueueMap = {}
local queueIn: {
[string]: {any}
} = {}
local queueInRequest: {
[string]: {any}
} = {}
local queueInRequest: {
[number]: {
[string]: {
Expand Down
4 changes: 2 additions & 2 deletions src/Index/Event.luau
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ local RunService = game:GetService("RunService")
local Type = require(script.Parent.Type)

if RunService:IsServer() then
if not script:FindFirstChild("Event") then
if not script:FindFirstChild("Reliable") then
Instance.new("RemoteEvent", script).Name = "Reliable"
end
if not script:FindFirstChild("Event2") then
if not script:FindFirstChild("Unreliable") then
Instance.new("UnreliableRemoteEvent", script).Name = "Unreliable"
end
if not script:FindFirstChild("Request") then
Expand Down
1 change: 1 addition & 0 deletions src/Index/Server/ServerProcess.luau
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--!native
--!strict
local ServerProcess = {}

Expand Down
30 changes: 17 additions & 13 deletions src/Index/Type.luau
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ export type rateLimitArg = {
}

export type Client = {
Fire: (self: Client, reliable: boolean, any) -> (),
Invoke: (self: Client, timeout: number, any) -> any,
Connect: (self: Client, callback: (args: any) -> ()) -> string,
Once: (self: Client, callback: (player: Player, args: any) -> ()) -> string,
Fire: (self: Client, reliable: boolean, ...any) -> (),
Invoke: (self: Client, timeout: number, ...any) -> any,
Connect: (self: Client, callback: (...any) -> ()) -> string,
Once: (self: Client, callback: (player: Player, ...any) -> ()) -> string,
Disconnect: (self: Client, key: string) -> (),
DisconnectAll: (self: Client) -> (),
Destroy: (self: Client) -> (),
Wait: (self: Client) -> number,
}

export type Server = {
Fire: (self: Server, reliable: boolean, player: Player, any) -> (),
Fires: (self: Server, reliable: boolean, any) -> (),
Invoke: (self: Server, timeout: number, player: Player, any) -> any,
Connect: (self: Server, callback: (player: Player, args: any) -> ()) -> string,
Once: (self: Server, callback: (player: Player, args: any) -> ()) -> string,
Fire: (self: Server, reliable: boolean, player: Player, ...any) -> (),
Fires: (self: Server, reliable: boolean, ...any) -> (),
Invoke: (self: Server, timeout: number, player: Player, ...any) -> any,
Connect: (self: Server, callback: (player: Player, ...any) -> ()) -> string,
Once: (self: Server, callback: (player: Player, ...any) -> ()) -> string,
Disconnect: (self: Server, key: string) -> (),
DisconnectAll: (self: Server) -> (),
Destroy: (self: Server) -> (),
Expand All @@ -33,10 +33,6 @@ export type Event = {
Request: RemoteEvent,
}

export type Ratelimit = {
create: (entrance: number, interval: number) -> (),
}

export type QueueMap = {
[string]: {
[any]: any,
Expand All @@ -51,4 +47,12 @@ export type StoredRatelimit = {
[string]: any
}

export type fromServerArray = {
[string]: Server
}

export type fromClientArray = {
[string]: Client
}

return nil
File renamed without changes.
24 changes: 24 additions & 0 deletions src/Index/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,28 @@ function Index.Client(Identifier: string): Type.Client
return require(Client.Index)(Identifier) :: Type.Client
end

function Index.fromServerArray(arrays: { any }): Type.fromServerArray
Assert(IsServer, `[Warp]: Calling .fromServerArray({arrays}) on client side (expected server side)`)
Assert(typeof(arrays) == "table", "[Warp]: Array must be a table type")
local copy = {}
for param1: any, param2: any in arrays do
if typeof(param2) == "table" then
copy[param1] = Index.Server(param1, param2)
else
copy[param2] = Index.Server(param2)
end
end
return table.freeze(copy) :: typeof(copy)
end

function Index.fromClientArray(arrays: { any }): Type.fromClientArray
Assert(not IsServer, `[Warp]: Calling .fromClientArray({arrays}) on server side (expected client side)`)
Assert(typeof(arrays) == "table", "[Warp]: Array must be a table type")
local copy = {}
for idx: number, identifier: string in arrays do
copy[identifier] = Index.Client(identifier)
end
return table.freeze(copy) :: typeof(copy)
end

return table.freeze(Index) :: typeof(Index)
4 changes: 3 additions & 1 deletion src/init.luau
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
-- Warp Library (@Eternity_Devs)
-- version 1.0.2
-- version 1.0.4
--!strict
--!native
local Index = require(script.Index)

return {
Server = Index.Server,
Client = Index.Client,
fromServerArray = Index.fromServerArray,
fromClientArray = Index.fromClientArray,
}
2 changes: 1 addition & 1 deletion wally.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "imezx/warp"
version = "1.0.2"
version = "1.0.4"
registry = "https://github.com/UpliftGames/wally-index"
realm = "shared"
license = "MIT"
Expand Down

0 comments on commit b5b64c3

Please sign in to comment.