This returns the active container object for the given id, complete with all public methods.
Then you can use the methods below on the container like so:
localcontainer=exports.list_inventory:get_container("some_container_id")ifnotcontainerthenprint("No container found for that ID")returnendcontainer:add_item("bandage", 2)
get_data
Get a specific field or the full container data.
Params
key (string, optional): The key to fetch
Returns
Value of the key or full data table
set_data
Set a custom field on the container.
Params
key (string): Field name
value (any): Value to store
Returns
true
get_items
Returns a table of all items in the container.
Returns
table: All container items indexed by slot
get_item
Returns the first matching item by slot, ID, or metadata.
Params
lookup (number|string|table): Slot number, item ID, or metadata table
Returns
Item object or nil
has_item
Checks if container contains an item by slot, ID, or metadata.
Params
lookup (number|string|table): Slot number, item ID, or metadata table