Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.
Open
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
10 changes: 9 additions & 1 deletion modules/inventory/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,15 @@ function Inventory.CanCarryItem(inv, item, count, metadata)
inv = Inventory(inv) --[[@as OxInventory]]

if inv then
local itemSlots, _, emptySlots = Inventory.GetItemSlots(inv, item, type(metadata) == 'table' and metadata or { type = metadata or nil })
local md
if type(metadata) == 'table' then
md = metadata
elseif type(metadata) == 'string' then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type value of metadata can be of any type, it doesn't have to be a string. I believe checking if metadata is not nil here is the better check

md = { type = metadata }
else
md = {}
end
local itemSlots, _, emptySlots = Inventory.GetItemSlots(inv, item, md)

if not itemSlots then return end

Expand Down