From a435a4a75c4b0de31b8239ce43c8b3f6f01011dd Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Fri, 29 Aug 2025 23:53:44 -0400 Subject: [PATCH] Restore stash registration return values Reverts stash registration to return a boolean and id, undoing a breaking change from commit #e06e04a. This restores compatibility with multiple resources and inventories that rely on the previous behavior. Also returning a success status on registration has many uses. --- modules/inventory/ox_inventory/server.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/inventory/ox_inventory/server.lua b/modules/inventory/ox_inventory/server.lua index eb3afd0..66aeaaa 100644 --- a/modules/inventory/ox_inventory/server.lua +++ b/modules/inventory/ox_inventory/server.lua @@ -130,17 +130,19 @@ Inventory.OpenStash = function(src, _type, id) ox_inventory:forceOpenInventory(src, _type, id) end +-- restores stashes to before commit #e06e04a (no depreication path followed, breaking change and not present on all inventories so undoing it. (also breaking multiple resources)) ---This will register a stash ----@param id string +---@param id number|string ---@param label string ---@param slots number ---@param weight number ---@param owner string ---@param groups table ---@param coords table ----@return string +---@return boolean +---@return string|number Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) - if Inventory.Stashes[id] then return id end + if Inventory.Stashes[id] then return true, id end Inventory.Stashes[id] = { id = id, label = label, @@ -151,7 +153,7 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor coords = coords } ox_inventory:RegisterStash(id, label, slots, weight, owner, groups, coords) - return id + return true, id end ---This will return a boolean if the player has the item.