2024-01-05 12:14:38 +00:00
|
|
|
--!strict
|
2026-02-10 18:11:25 +00:00
|
|
|
--@EternityDev
|
2026-05-07 05:14:08 +00:00
|
|
|
|
2026-02-10 18:11:25 +00:00
|
|
|
local Remote = {}
|
2024-01-05 12:14:38 +00:00
|
|
|
|
2026-05-07 05:14:08 +00:00
|
|
|
if game:GetService("RunService"):IsServer() then
|
2026-02-16 07:41:45 +00:00
|
|
|
if not script:FindFirstChild("_repl") then
|
|
|
|
|
Instance.new("RemoteEvent", script).Name = "_repl"
|
|
|
|
|
end
|
2026-02-10 18:11:25 +00:00
|
|
|
if not script:FindFirstChild("Event") then
|
|
|
|
|
Instance.new("RemoteEvent", script).Name = "Event"
|
|
|
|
|
end
|
2026-02-11 08:00:23 +00:00
|
|
|
if not script:FindFirstChild("UnreliableEvent") then
|
|
|
|
|
Instance.new("UnreliableRemoteEvent", script).Name = "UnreliableEvent"
|
|
|
|
|
end
|
2026-02-10 18:11:25 +00:00
|
|
|
end
|
2024-12-01 14:10:56 +00:00
|
|
|
|
2026-02-10 18:11:25 +00:00
|
|
|
local Client = require("@self/Client")
|
|
|
|
|
local Server = require("@self/Server")
|
2026-02-13 10:37:23 +00:00
|
|
|
local Buffer = require("@self/Util/Buffer")
|
2024-03-16 16:49:23 +00:00
|
|
|
|
2026-02-11 04:34:45 +00:00
|
|
|
--[[
|
|
|
|
|
@class Remote
|
|
|
|
|
@client
|
2026-05-07 05:14:08 +00:00
|
|
|
client library of `Warp`, use it only on client
|
2026-02-11 04:34:45 +00:00
|
|
|
]]
|
2026-05-07 05:14:08 +00:00
|
|
|
Remote.Client = setmetatable(Client, {
|
|
|
|
|
__call = function()
|
|
|
|
|
return Client
|
|
|
|
|
end,
|
|
|
|
|
})
|
2026-02-10 18:11:25 +00:00
|
|
|
|
2026-02-11 04:34:45 +00:00
|
|
|
--[[
|
|
|
|
|
@class Remote
|
|
|
|
|
@server
|
2026-05-07 05:14:08 +00:00
|
|
|
server library of `Warp`, use it only on server
|
2026-02-11 04:34:45 +00:00
|
|
|
]]
|
2026-05-07 05:14:08 +00:00
|
|
|
Remote.Server = setmetatable(Server, {
|
|
|
|
|
__call = function()
|
|
|
|
|
return Server
|
|
|
|
|
end,
|
|
|
|
|
})
|
2026-02-10 18:11:25 +00:00
|
|
|
|
2026-02-11 04:34:45 +00:00
|
|
|
--[[
|
|
|
|
|
@class Remote
|
|
|
|
|
@schema
|
|
|
|
|
define a schema for your data and use a strict packing
|
|
|
|
|
]]
|
|
|
|
|
Remote.Buffer = Buffer
|
|
|
|
|
|
2026-05-07 05:14:08 +00:00
|
|
|
-- making a strict table from `Warp` (Remote) - catching early errors and preventing changes/replacements of keys in the table
|
|
|
|
|
return setmetatable(Remote, {
|
|
|
|
|
__index = function(_self: any, key: any): never
|
|
|
|
|
error(`{key} is not valid member of Warp.\nPlease check documentation here: https://imezx.github.io/Warp/`)
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
__newindex = function(_self: any, key: any, _value: any): never
|
|
|
|
|
error(`{key} is not valid member of Warp.\nPlease check documentation here: https://imezx.github.io/Warp/`)
|
|
|
|
|
end,
|
|
|
|
|
}) :: typeof(Remote) -- saving the typing
|