update docs

This commit is contained in:
EternityDev 2024-01-30 20:33:31 +07:00
parent 15f485da51
commit 7846882bf5
4 changed files with 66 additions and 12 deletions

View file

@ -2,7 +2,7 @@
For Client-sided For Client-sided
## `.Client` ## `.Client` <Badge type="warning" text="yield" />
Create new Warp event. Create new Warp event.
@ -14,7 +14,32 @@ Create new Warp event.
``` ```
```lua [Example] ```lua [Example]
local Remote = Warp.new("Remote") local Remote = Warp.Client("Remote")
```
:::
## `.fromClientArray` <Badge type="warning" text="yield" />
Create new Warp events with array.
::: code-group
```lua [Variable]
(
{ any }
)
```
```lua [Example]
local Events = Warp.fromClientArray({
"Remote1",
"Remote2",
"Remote3",
})
-- Usage
Events.Remote1:Connect(function(...) end)
Events.Remote2:Connect(function(...) end)
Events.Remote3:Connect(function(...) end)
``` ```
::: :::
@ -101,7 +126,7 @@ Remote:Fire(true, "Hello World!")
This function have rate limiting it self and configured from server. This function have rate limiting it self and configured from server.
::: :::
## `:Invoke` ## `:Invoke` <Badge type="warning" text="yield" />
Semiliar to `:InvokeServer`, its for Invoke to a server. Semiliar to `:InvokeServer`, its for Invoke to a server.
@ -122,7 +147,7 @@ local Request = Remote:Invoke(2, "Hello World!")
This function is yielded, once it timeout it will return nil. This function is yielded, once it timeout it will return nil.
::: :::
## `:Wait` ## `:Wait` <Badge type="warning" text="yield" />
Wait the event being triggered. Wait the event being triggered.

View file

@ -2,11 +2,11 @@
Ratelimit is one of most useful feature. Ratelimit is one of most useful feature.
( Configured on Server and For Client ) ( Configured on Server only and For Client )
## `Setup` ## `Setup`
When creating a event on Server, you can add second argument as table `rateLimit` to limit the number of times the event can be called and the interval for reset the counter. When creating a event on Server, you can add second argument (optional) as table `rateLimit` to limit the number of times the event can be called and the interval for reset the counter on client-side.
::: code-group ::: code-group
```lua [Server] ```lua [Server]
@ -22,7 +22,7 @@ local Remote = Warp.Server("Remote1", {
```lua [Client] ```lua [Client]
-- Client -- Client
local Remote = Warp.Client("Remote1") local Remote = Warp.Client("Remote1") -- Yields, retreive rateLimit configuration.
-- The Event will automatic it self for retreiving the rate limit configuration from the server. -- The Event will automatic it self for retreiving the rate limit configuration from the server.
``` ```
::: :::

View file

@ -2,7 +2,7 @@
For Server-sided For Server-sided
## `.Server` ## `.Server` <Badge type="warning" text="yield" />
Create new Warp event. Create new Warp event.
@ -18,10 +18,39 @@ Create new Warp event.
``` ```
```lua [Example] ```lua [Example]
local Remote = Warp.new("Remote") local Remote = Warp.Server("Remote")
``` ```
::: :::
## `.fromServerArray` <Badge type="warning" text="yield" />
Create new Warp events with array.
::: code-group
```lua [Variable]
(
{ any }
)
```
```lua [Example]
local Events = Warp.fromServerArray({
["Remote1"] = {
maxEntrance: 50,
interval: 1,
}, -- with rateLimit configuration
"Remote2", -- without rateLimit configuration
["Remote3"] = {
maxEntrance: 10,
}, -- with rateLimit configuration
})
-- Usage
Events.Remote1:Connect(function(player, ...) end)
Events.Remote2:Connect(function(player, ...) end)
Events.Remote3:Connect(function(player, ...) end)
```
:::
## `:Connect` ## `:Connect`
Connect event to receive incoming from client way. Connect event to receive incoming from client way.
@ -121,7 +150,7 @@ Remote:Fires(true, "Hello World!")
``` ```
::: :::
## `:Invoke` ## `:Invoke` <Badge type="warning" text="yield" />
Semiliar to `:InvokeClient`, its for Invoke to a client. Semiliar to `:InvokeClient`, its for Invoke to a client.
@ -143,7 +172,7 @@ local Request = Remote:Invoke(2, player, "Hello World!")
This function is yielded, once it timeout it will return nil. This function is yielded, once it timeout it will return nil.
::: :::
## `:Wait` ## `:Wait` <Badge type="warning" text="yield" />
Wait the event being triggered. Wait the event being triggered.

View file

@ -8,7 +8,7 @@
::: code-group ::: code-group
```toml [wally.toml] ```toml [wally.toml]
[dependencies] [dependencies]
warp = "imezx/warp@1.0.0" warp = "imezx/warp@1.0.4"
``` ```
3. Run `wally install` in command. 3. Run `wally install` in command.