mirror of
https://github.com/imezx/Warp.git
synced 2026-03-18 00:44:16 +00:00
chore(docs): made few changes for newer version
This commit is contained in:
parent
4f874ed34e
commit
f5f746b37a
3 changed files with 35 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
# Warp <Badge type="tip" text="1.0" />
|
# Warp <Badge type="tip" text="1.0" /> <Badge type="warning" text="deprecated" />
|
||||||
|
|
||||||
The public main of the Warp library.
|
The public main of the Warp library.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Warp <Badge type="tip" text="1.1" />
|
# Warp <Badge type="tip" text="1.1" /> <Badge type="warning" text="pre-release" />
|
||||||
|
|
||||||
The public main of the Warp library.
|
The public main of the Warp library.
|
||||||
::: warning
|
::: warning
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,50 @@
|
||||||
# Getting Started <Badge type="tip" text="1.0" />
|
# Getting Started <Badge type="tip" text="1.1" />
|
||||||
|
|
||||||
### `Step 1:`
|
### `Installation`
|
||||||
First, you have to require the Warp module.
|
First, you have to require the Warp module.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local Warp = require('path.to.module');
|
local Warp = require(path.to.module)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `Step 2:`
|
Then, you should do `.Server` or `.Client`
|
||||||
Then, to create a new event you have to use `.Server` function
|
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local Remote = Warp.Server("EventName");
|
local Server = Warp.Server() --> for Server-side only
|
||||||
|
local Client = Warp.Client() --> for Client-side only
|
||||||
```
|
```
|
||||||
|
|
||||||
### `Step 3:`
|
### `Basic Usage`
|
||||||
Firing event everytime player join
|
Firing event everytime player join
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local Players = game:GetService("Players")
|
local Players = game:GetService("Players")
|
||||||
|
|
||||||
Players.PlayerAdded:Connect(function(player)
|
Players.PlayerAdded:Connect(function(player: Player)
|
||||||
Remote:Fire(true, player, "Welcome!")
|
Server.Fire("MessageEvent", true, player, "Welcome!")
|
||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
Add a listener (works for both `.Invoke` & `.Fire`)
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local connection = Server.Connect("Ping", function(player: Player)
|
||||||
|
return "Pong"
|
||||||
|
end)
|
||||||
|
print(connection.Connected)
|
||||||
|
-- connection:Disconnect()
|
||||||
|
```
|
||||||
|
Send or Request a event
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- Reliable-RemoteEvent
|
||||||
|
Client.Fire("test", true, "hey")
|
||||||
|
-- Unreliable-RemoteEvent
|
||||||
|
Client.Fire("test", false, "hello from client!!")
|
||||||
|
-- Invoke
|
||||||
|
local response = Client.Invoke("Ping")
|
||||||
|
if not response then
|
||||||
|
warn("Server didn't ping back :(")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
print(response, "from Server!")
|
||||||
|
```
|
||||||
Loading…
Reference in a new issue