# ox\_inventory

* Add the following function at the end of the file

{% code title="ox\_inventory/modules/inventory/server.lua" %}

```lua
function Inventory.SetStash(stashid, items)
	local items = items
	local stash = Inventory(stashid)
	if not stash then return end

	Inventory.CloseAll(stash)

	stash.changed = true
	stash.items = {}
	stash.weight = 0
	for k,i in pairs(items) do
		if i.name then 
			local item = Items(i.name)
			if item then
				local metadata, count = Items.Metadata(stash, item, i.metadata or {}, i.count)
				local slotWeight = Inventory.SlotWeight(item, {count=count, metadata=metadata})
				stash.weight += slotWeight
				stash.items[i.slot] = {name = item.name, label = item.label, degrade = i.degrade or 0, weight = slotWeight, slot = i.slot, count = count, description = item.description, metadata = metadata, stack = item.stack, close = item.close}
			end
		end
	end
	Inventories[stash.id] = stash
	Inventory.Save(stash)
end
```

{% endcode %}

* Below the previous function, add the export of it

{% code title="ox\_inventory/modules/inventory/server.lua" %}

```lua
exports('SetStash', Inventory.SetStash)
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.origennetwork.store/origen-masterjob/installation/ox_inventory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
