Skip to content

Commit

Permalink
Add code samples
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanLua committed May 17, 2024
1 parent ab2ea72 commit 6dc13c0
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ Determines the transparency of the text stroke of text in default chat window an

Returns whether the inventory is opened or not.

#### Code Samples

This code sample will return whether the inventory is opened or not.

```lua title="Is Opened" linenums="1"
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Satchel = require(ReplicatedStorage:WaitForChild("Satchel"))

local isOpened = Satchel.IsOpened()
```

#### Returns

<table>
Expand All @@ -185,6 +196,17 @@ Returns whether the inventory is opened or not.

Sets whether the backpack gui is enabled or disabled.

#### Code Samples

This code sample will disable the backpack gui.

```lua title="Disable Backpack" linenums="1"
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Satchel = require(ReplicatedStorage:WaitForChild("Satchel"))

Satchel.SetBackpackEnabled(false)
```

#### Parameters

<table>
Expand All @@ -206,6 +228,17 @@ Sets whether the backpack gui is enabled or disabled.

Returns whether the backpack gui is enabled or disabled.

#### Code Samples

This code sample will return whether the backpack gui is enabled or disabled.

```lua title="Get Backpack Enabled" linenums="1"
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Satchel = require(ReplicatedStorage:WaitForChild("Satchel"))

local isEnabled = Satchel.GetBackpackEnabled()
```

#### Returns

<table>
Expand All @@ -218,6 +251,24 @@ Returns whether the backpack gui is enabled or disabled.

Returns a signal that fires when the inventory is opened or closed.

#### Code Samples

This code sample detects when the inventory is opened or closed.

```lua title="Detect Inventory State" linenums="1"
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Satchel = require(ReplicatedStorage:WaitForChild("Satchel"))

Satchel.GetStateChangedEvent():Connect(function(isOpened: boolean)
if isOpened then
print("Inventory opened")
else
print("Inventory closed")
end
end)
```


Check failure on line 271 in docs/api-reference.md

View workflow job for this annotation

GitHub Actions / lint

Multiple consecutive blank lines

docs/api-reference.md:271 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md012.md

Check failure on line 271 in docs/api-reference.md

View workflow job for this annotation

GitHub Actions / lint

Multiple consecutive blank lines

docs/api-reference.md:271 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md012.md
#### Returns

<table>
Expand Down

0 comments on commit 6dc13c0

Please sign in to comment.