Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Commit

Permalink
update docs quality
Browse files Browse the repository at this point in the history
  • Loading branch information
imezx committed Sep 6, 2023
1 parent a8ccbd2 commit dcc1135
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 75 deletions.
51 changes: 31 additions & 20 deletions docs/api/1.0/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,64 @@ A Client-sided Connection

Create new FastNet2 event

```lua
::: code-group
```lua [main]
(
Identifier: string
)
```

Identifier will converte/encode into hash identifier

```lua
```lua [Example]
local Remote = FastNet2.new("Remote")
```
:::

Identifier will converte/encode into hash identifier

## `:Connect` or `:Listen`

Listen an event from the server to receive, `:Connect` and `:Listen` is the same function.

```lua
::: code-group
```lua [main]
(
player: Player,
callback: (...any) -> ()
)
```

Each event only allowed have one callback.

```lua
Remote:Connect(function(...)
```lua [Example]
Remote:Connect(function(player, ...)
print(...)
end)
```

to know if the event is connected or not by doing `.Connected`

```lua
```lua [Extra]
-- to know if the event is connected or not by doing `.Connected`
print(Remote.Connected)
```
:::

Each event only allowed have one callback.

## `:Once`

This function is same as `:Connect` but it disconnect the event once it fired.

```lua
::: code-group
```lua [main]
(
player: Player,
callback: (...any) -> ()
)
```

```lua
Remote:Once(function(...)
```lua [Example]
Remote:Once(function(player, ...)
print(...)
end)
```
:::

## `:Disconnect`

Expand All @@ -68,17 +75,19 @@ Remote:Disconnect()

## `:Fire`

Fire the event to the server with data.
Fire the event to the spesific server with data.

```lua
::: code-group
```lua [main]
(
...: any
)
```

```lua
```lua [Example]
Remote:Fire("Hello World!")
```
:::

::: warning
This function have rate limiting to prevent spamming
Expand All @@ -88,16 +97,18 @@ This function have rate limiting to prevent spamming

Pull is a function that invoke to server.

```lua
::: code-group
```lua [main]
(
timeout: number,
...: any
) -> (...any)
```

```lua
```lua [Example]
local Request = Remote:Pull(2, "Hello World!")
```
:::

::: warning
This function is yielded, and the minimum for timeout is 2 (seconds)
Expand Down
2 changes: 1 addition & 1 deletion docs/api/1.0/fastnet2.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FastNet2
# FastNet2 <Badge type="tip" text="Beta" />

The public main of the FastNet2 library.

Expand Down
60 changes: 32 additions & 28 deletions docs/api/1.0/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,64 @@ A Server-sided Connection

Create new FastNet2 event

```lua
::: code-group
```lua [main]
(
Identifier: string
)
```

Identifier will converte/encode into hash identifier

```lua
```lua [Example]
local Remote = FastNet2.new("Remote")
```
:::

Identifier will converte/encode into hash identifier

## `:Connect` or `:Listen`

Listen an event from the server to receive, `:Connect` and `:Listen` is the same function.
Listen an event from the client to receive, `:Connect` and `:Listen` is the same function.

```lua
::: code-group
```lua [main]
(
player: Player,
callback: (...any) -> ()
)
```

Each event only allowed have one callback.

```lua
```lua [Example]
Remote:Connect(function(player, ...)
print(...)
end)
```

to know if the event is connected or not by doing `.Connected`

```lua
```lua [Extra]
-- to know if the event is connected or not by doing `.Connected`
print(Remote.Connected)
```
:::

Each event only allowed have one callback.

## `:Once`

This function is same as `:Connect` but it disconnect the event once it fired.

```lua
::: code-group
```lua [main]
(
player: Player,
callback: (...any) -> ()
)
```

```lua
```lua [Example]
Remote:Once(function(player, ...)
print(...)
end)
```
:::

## `:Disconnect`

Expand All @@ -71,54 +77,52 @@ Remote:Disconnect()

Fire the event to the spesific client with data.

```lua
::: code-group
```lua [main]
(
player: Player,
...: any
)
```

```lua
```lua [Example]
Remote:Fire(player, "Hello World!")
```

::: warning
This function have rate limiting to prevent spamming
:::

## `:Fires`
## `:Fires` <Badge type="tip" text="Server Only" />

Fire the event to all clients with data.

```lua
::: code-group
```lua [main]
(
...: any
)
```

```lua
```lua [Example]
Remote:Fires("Hello World!")
```

::: warning
This function have rate limiting to prevent spamming
:::

## `:Pull`

Pull is a function that invoke to server.
Pull is a function that invoke to client.

```lua
::: code-group
```lua [main]
(
timeout: number,
player: Player,
...: any
) -> (...any)
```

```lua
```lua [Example]
local Request = Remote:Pull(2, player, "Hello World!")
```
:::

::: warning
This function is yielded, and the minimum for timeout is 2 (seconds)
Expand Down
43 changes: 24 additions & 19 deletions docs/api/1.0/signal.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,60 @@ Signal (an alternative for bindable events)

Create new Signal event

```lua
::: code-group
```lua [main]
(
Identifier: string
)
```

```lua
```lua [Example]
local Signal = FastNet2.Signal("TestSignal")
```
:::

## `:Connect`

Listen an event to signal.

```lua
::: code-group
```lua [main]
(
callback: (...any) -> ()
)
```

Each signal event only allowed have one callback.

```lua
```lua [Example]
Signal:Connect(function(...)
print(...)
end)
```

to know if the signal is connected or not by doing `.Connected`

```lua
```lua [Extra]
-- to know if the signal is connected or not by doing `.Connected`
print(Signal.Connected)
```
:::

Each signal event only allowed have one callback.

## `:Once`

This function is same as `:Connect` but it disconnect the signal once it fired.

```lua
::: code-group
```lua [main]
(
callback: (...any) -> ()
)
```

```lua
```lua [Example]
Signal:Once(function(...)
print(...)
end)
```
:::

## `:Disconnect`

Expand All @@ -68,37 +73,37 @@ Signal:Disconnect()

Fire the signal with data.

```lua
::: code-group
```lua [main]
(
...: any
)
```

```lua
```lua [Example]
Signal:Fire("Hello World!")
```

::: warning
This function have rate limiting to prevent spamming
:::

## `:Invoke`

Invoke is a function that invoke to signal.

```lua
::: code-group
```lua [main]
(
timeout: number,
...: any
) -> (...any)
```

```lua
```lua [Example]
local Request = Signal:Invoke(2, "Hello World!")
```
:::

::: warning
This function is yielded, and this function still on beta
This function is yielded
:::

## `:Wait`
Expand Down
Loading

0 comments on commit dcc1135

Please sign in to comment.