Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 62 additions & 52 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
Purse unlocks APIs for the CoreGui backpack which were previously locked to other CoreGui scripts. To access the APIs, just require Purse like any other [module script]:
Purse unlocks APIs for the CoreGui backpack which were previously locked to other CoreGui scripts. To access the APIs, just require Purse like any other [module script].

``` lua title="Toggle Inventory Example"
``` lua title="LocalScript - Inventory Toggle Button" linenums="1"
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Purse = require(ReplicatedStorage.Purse)

Purse.OpenClose() -- Toggle the inventory
local button = script.Parent

local function onButtonActivated()
Purse.OpenClose() -- Toggle the inventory
end

button.Activated:Connect(onButtonActivated)
```

[module script]: https://create.roblox.com/docs/reference/engine/classes/ModuleScript
Expand All @@ -14,99 +20,103 @@ Purse.OpenClose() -- Toggle the inventory

### OpenClose

Toggles the backpack open/closed state. If the backpack is currently open, it will close it. If closed, it will open it.
```
OpenClose(): ()
```

Toggles whether or not the inventory is visible.

### IsInventoryEmpty

```
IsInventoryEmpty(): boolean
```

Returns true if the inventory is empty.

## Properties

### IsHotbarVisible

Returns if the hotbar is currently visible to the player.

#### Returns
```
IsHotbarVisible: boolean
```

[boolean]
Determines whether or not the hotbar is visible.

### IsOpen

Returns if the inventory is currently open to the player.

#### Returns
```
IsOpen: boolean
```

[boolean]
Returns true if the inventory is open.

### ModuleName

Returns the module name. This will always return "Backpack".

#### Returns
```
ModuleName: string
```

[string]
Returns "Backpack".

### KeepVRTopbarOpen

Returns `true`.

#### Returns
```
KeepVRTopbarOpen: boolean
```

[boolean]
Returns true.

### VRIsExclusive

Returns `true`.

#### Returns
```
VRIsExclusive: boolean
```

[boolean]
Returns true.

### VRClosesNonExclusive

Returns `true`.

#### Returns

[boolean]

### IsInventoryEmpty

Returns if the inventory is empty.

#### Returns
```
VRClosesNonExclusive: boolean
```

[boolean]
Returns true.

## Events

### StateChanged

Fires when the backpack is closed or opened.

#### Returns
```
StateChanged(isNowOpen: boolean): BindableEvent
```

[BindableEvent]
Fires after the inventory is opened or closed.

### BackpackEmpty

Fires when the inventory is empty.

#### Returns
```
BackpackEmpty(): BindableEvent
```

[BindableEvent]
Fires when the backpack becomes empty.

### BackpackItemAdded

Fires when a item is added to the inventory.

#### Returns
```
BackpackItemAdded(): BindableEvent
```

[BindableEvent]
Fires when an item is added to the backpack.

### BackpackItemRemoved

Fires when a item is removed from the inventory.

#### Returns
```
BackpackItemRemoved(): BindableEvent
```

[BindableEvent]
Fires when an item is removed from the backpack.

[BindableEvent]: https://create.roblox.com/docs/reference/engine/classes/BindableEvent
[boolean]: https://create.roblox.com/docs/luau/booleans
Expand Down
3 changes: 0 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ markdown_extensions:
- attr_list
- toc:
permalink: true
toc_depth: 3
- pymdownx.superfences
- pymdownx.highlight:
linenums: true

nav:
- Home: index.md
Expand Down