From 7846882bf5d2d0c80b0384a20f57df536339da01 Mon Sep 17 00:00:00 2001 From: EternityDev Date: Tue, 30 Jan 2024 20:33:31 +0700 Subject: [PATCH] update docs --- docs/api/1.0/client.md | 33 +++++++++++++++++++++++++++++---- docs/api/1.0/ratelimit.md | 6 +++--- docs/api/1.0/server.md | 37 +++++++++++++++++++++++++++++++++---- docs/guide/installation.md | 2 +- 4 files changed, 66 insertions(+), 12 deletions(-) diff --git a/docs/api/1.0/client.md b/docs/api/1.0/client.md index 27ee7df..adddf4b 100644 --- a/docs/api/1.0/client.md +++ b/docs/api/1.0/client.md @@ -2,7 +2,7 @@ For Client-sided -## `.Client` +## `.Client` 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` + +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` 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` Wait the event being triggered. diff --git a/docs/api/1.0/ratelimit.md b/docs/api/1.0/ratelimit.md index 0fe46d3..da2e137 100644 --- a/docs/api/1.0/ratelimit.md +++ b/docs/api/1.0/ratelimit.md @@ -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. ``` ::: \ No newline at end of file diff --git a/docs/api/1.0/server.md b/docs/api/1.0/server.md index 2a2d07a..e621306 100644 --- a/docs/api/1.0/server.md +++ b/docs/api/1.0/server.md @@ -2,7 +2,7 @@ For Server-sided -## `.Server` +## `.Server` 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` + +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` 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` Wait the event being triggered. diff --git a/docs/guide/installation.md b/docs/guide/installation.md index f5fe913..77c193a 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -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.