This commit is contained in:
EternityDev 2024-01-30 13:36:08 +07:00
parent c12356af4e
commit b5b64c3469
10 changed files with 52 additions and 17 deletions

BIN
Warp.rbxm

Binary file not shown.

Binary file not shown.

View file

@ -1,3 +1,4 @@
--!native
--!strict
local ClientProcess = {}
@ -18,6 +19,9 @@ local clientRequestQueue: Type.QueueMap = {}
local queueIn: {
[string]: {any}
} = {}
local queueInRequest: {
[string]: {any}
} = {}
local queueInRequest: {
[number]: {
[string]: {

View file

@ -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

View file

@ -1,3 +1,4 @@
--!native
--!strict
local ServerProcess = {}

View file

@ -5,10 +5,10 @@ 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) -> (),
@ -16,11 +16,11 @@ export type Client = {
}
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) -> (),
@ -33,10 +33,6 @@ export type Event = {
Request: RemoteEvent,
}
export type Ratelimit = {
create: (entrance: number, interval: number) -> (),
}
export type QueueMap = {
[string]: {
[any]: any,
@ -51,4 +47,12 @@ export type StoredRatelimit = {
[string]: any
}
export type fromServerArray = {
[string]: Server
}
export type fromClientArray = {
[string]: Client
}
return nil

View file

@ -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)

View file

@ -1,5 +1,5 @@
-- Warp Library (@Eternity_Devs)
-- version 1.0.2
-- version 1.0.4
--!strict
--!native
local Index = require(script.Index)
@ -7,4 +7,6 @@ local Index = require(script.Index)
return {
Server = Index.Server,
Client = Index.Client,
fromServerArray = Index.fromServerArray,
fromClientArray = Index.fromClientArray,
}

View file

@ -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"