mirror of
https://github.com/imezx/Warp.git
synced 2025-04-24 07:00:03 +00:00
v1.0.4
This commit is contained in:
parent
c12356af4e
commit
b5b64c3469
10 changed files with 52 additions and 17 deletions
BIN
Warp.rbxm
BIN
Warp.rbxm
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,4 @@
|
||||||
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
local ClientProcess = {}
|
local ClientProcess = {}
|
||||||
|
|
||||||
|
@ -18,6 +19,9 @@ local clientRequestQueue: Type.QueueMap = {}
|
||||||
local queueIn: {
|
local queueIn: {
|
||||||
[string]: {any}
|
[string]: {any}
|
||||||
} = {}
|
} = {}
|
||||||
|
local queueInRequest: {
|
||||||
|
[string]: {any}
|
||||||
|
} = {}
|
||||||
local queueInRequest: {
|
local queueInRequest: {
|
||||||
[number]: {
|
[number]: {
|
||||||
[string]: {
|
[string]: {
|
||||||
|
|
|
@ -3,10 +3,10 @@ local RunService = game:GetService("RunService")
|
||||||
local Type = require(script.Parent.Type)
|
local Type = require(script.Parent.Type)
|
||||||
|
|
||||||
if RunService:IsServer() then
|
if RunService:IsServer() then
|
||||||
if not script:FindFirstChild("Event") then
|
if not script:FindFirstChild("Reliable") then
|
||||||
Instance.new("RemoteEvent", script).Name = "Reliable"
|
Instance.new("RemoteEvent", script).Name = "Reliable"
|
||||||
end
|
end
|
||||||
if not script:FindFirstChild("Event2") then
|
if not script:FindFirstChild("Unreliable") then
|
||||||
Instance.new("UnreliableRemoteEvent", script).Name = "Unreliable"
|
Instance.new("UnreliableRemoteEvent", script).Name = "Unreliable"
|
||||||
end
|
end
|
||||||
if not script:FindFirstChild("Request") then
|
if not script:FindFirstChild("Request") then
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
local ServerProcess = {}
|
local ServerProcess = {}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ export type rateLimitArg = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Client = {
|
export type Client = {
|
||||||
Fire: (self: Client, reliable: boolean, any) -> (),
|
Fire: (self: Client, reliable: boolean, ...any) -> (),
|
||||||
Invoke: (self: Client, timeout: number, any) -> any,
|
Invoke: (self: Client, timeout: number, ...any) -> any,
|
||||||
Connect: (self: Client, callback: (args: any) -> ()) -> string,
|
Connect: (self: Client, callback: (...any) -> ()) -> string,
|
||||||
Once: (self: Client, callback: (player: Player, args: any) -> ()) -> string,
|
Once: (self: Client, callback: (player: Player, ...any) -> ()) -> string,
|
||||||
Disconnect: (self: Client, key: string) -> (),
|
Disconnect: (self: Client, key: string) -> (),
|
||||||
DisconnectAll: (self: Client) -> (),
|
DisconnectAll: (self: Client) -> (),
|
||||||
Destroy: (self: Client) -> (),
|
Destroy: (self: Client) -> (),
|
||||||
|
@ -16,11 +16,11 @@ export type Client = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Server = {
|
export type Server = {
|
||||||
Fire: (self: Server, reliable: boolean, player: Player, any) -> (),
|
Fire: (self: Server, reliable: boolean, player: Player, ...any) -> (),
|
||||||
Fires: (self: Server, reliable: boolean, any) -> (),
|
Fires: (self: Server, reliable: boolean, ...any) -> (),
|
||||||
Invoke: (self: Server, timeout: number, player: Player, any) -> any,
|
Invoke: (self: Server, timeout: number, player: Player, ...any) -> any,
|
||||||
Connect: (self: Server, callback: (player: Player, args: any) -> ()) -> string,
|
Connect: (self: Server, callback: (player: Player, ...any) -> ()) -> string,
|
||||||
Once: (self: Server, callback: (player: Player, args: any) -> ()) -> string,
|
Once: (self: Server, callback: (player: Player, ...any) -> ()) -> string,
|
||||||
Disconnect: (self: Server, key: string) -> (),
|
Disconnect: (self: Server, key: string) -> (),
|
||||||
DisconnectAll: (self: Server) -> (),
|
DisconnectAll: (self: Server) -> (),
|
||||||
Destroy: (self: Server) -> (),
|
Destroy: (self: Server) -> (),
|
||||||
|
@ -33,10 +33,6 @@ export type Event = {
|
||||||
Request: RemoteEvent,
|
Request: RemoteEvent,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Ratelimit = {
|
|
||||||
create: (entrance: number, interval: number) -> (),
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueueMap = {
|
export type QueueMap = {
|
||||||
[string]: {
|
[string]: {
|
||||||
[any]: any,
|
[any]: any,
|
||||||
|
@ -51,4 +47,12 @@ export type StoredRatelimit = {
|
||||||
[string]: any
|
[string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type fromServerArray = {
|
||||||
|
[string]: Server
|
||||||
|
}
|
||||||
|
|
||||||
|
export type fromClientArray = {
|
||||||
|
[string]: Client
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
|
@ -28,4 +28,28 @@ function Index.Client(Identifier: string): Type.Client
|
||||||
return require(Client.Index)(Identifier) :: Type.Client
|
return require(Client.Index)(Identifier) :: Type.Client
|
||||||
end
|
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)
|
return table.freeze(Index) :: typeof(Index)
|
|
@ -1,5 +1,5 @@
|
||||||
-- Warp Library (@Eternity_Devs)
|
-- Warp Library (@Eternity_Devs)
|
||||||
-- version 1.0.2
|
-- version 1.0.4
|
||||||
--!strict
|
--!strict
|
||||||
--!native
|
--!native
|
||||||
local Index = require(script.Index)
|
local Index = require(script.Index)
|
||||||
|
@ -7,4 +7,6 @@ local Index = require(script.Index)
|
||||||
return {
|
return {
|
||||||
Server = Index.Server,
|
Server = Index.Server,
|
||||||
Client = Index.Client,
|
Client = Index.Client,
|
||||||
|
fromServerArray = Index.fromServerArray,
|
||||||
|
fromClientArray = Index.fromClientArray,
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "imezx/warp"
|
name = "imezx/warp"
|
||||||
version = "1.0.2"
|
version = "1.0.4"
|
||||||
registry = "https://github.com/UpliftGames/wally-index"
|
registry = "https://github.com/UpliftGames/wally-index"
|
||||||
realm = "shared"
|
realm = "shared"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
Loading…
Reference in a new issue