> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaksam-scripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get item from slot

> Gets an item from a specific slot in an inventory.

Gets an item from a specific slot in an inventory.

<CodeGroup>
  ```lua Export theme={null}
  exports['jaksam_inventory']:getItemFromSlot(inventoryId, slotId, returnRaw)
  ```

  ```lua Example theme={null}
  -- Get item from player's slot 5
  local playerId = 1
  local item = exports['jaksam_inventory']:getItemFromSlot(playerId, 5)

  if item then
      print('Item name:', item.name)
      print('Amount:', item.amount)
      print('Metadata:', json.encode(item.metadata))

      item.metadata.durability = 50 -- update metadata
      exports['jaksam_inventory']:setItemMetadataInSlot(playerId, 5, item.metadata) -- save metadata
  end

  -- Get item from stash
  local stashItem = exports['jaksam_inventory']:getItemFromSlot('police_stash_1', 3)
  ```
</CodeGroup>

### Parameters

| Name          | Data Type        | Description                                                                                        |
| ------------- | ---------------- | -------------------------------------------------------------------------------------------------- |
| `inventoryId` | string \| number | The inventory ID to get the item from. Can be a player server ID (number) or inventory ID (string) |
| `slotId`      | number           | The slot number to get the item from                                                               |

### Return value

| Name   | Data Type    | Description                                                                      |
| ------ | ------------ | -------------------------------------------------------------------------------- |
| `item` | table \| nil | The item in the slot (`name`, `amount`, `metadata`), or nil if the slot is empty |

### Notes

<Info>
  \[TODO: INFORMATION NEEDED] The export signature accepts a third `returnRaw` parameter that isn't documented in the source material used for this page.
</Info>


## Related topics

- [Get item from slot](/jaksam-inventory/functions/client/get-item-from-slot.md)
- [Item transferred](/jaksam-inventory/hooks/on-item-transferred.md)
- [Server](/jaksam-inventory/functions/server/index.md)
- [Client](/jaksam-inventory/functions/client/index.md)
- [Get item by name](/jaksam-inventory/functions/client/get-item-by-name.md)
