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
## `.Client`
## `.Client` <Badge type="warning" text="yield" />
Create new Warp event.
@ -14,7 +14,32 @@ Create new Warp event.
```
```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.
:::
## `:Invoke`
## `:Invoke` <Badge type="warning" text="yield" />
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.
:::
## `:Wait`
## `:Wait` <Badge type="warning" text="yield" />
Wait the event being triggered.

View file

@ -2,11 +2,11 @@
Ratelimit is one of most useful feature.
( Configured on Server and For Client )
( Configured on Server only and For Client )
## `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
```lua [Server]
@ -22,7 +22,7 @@ local Remote = Warp.Server("Remote1", {
```lua [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.
```
:::

View file

@ -2,7 +2,7 @@
For Server-sided
## `.Server`
## `.Server` <Badge type="warning" text="yield" />
Create new Warp event.
@ -18,10 +18,39 @@ Create new Warp event.
```
```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 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.
@ -143,7 +172,7 @@ local Request = Remote:Invoke(2, player, "Hello World!")
This function is yielded, once it timeout it will return nil.
:::
## `:Wait`
## `:Wait` <Badge type="warning" text="yield" />
Wait the event being triggered.

View file

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