Skip to content

Commit

Permalink
refactor(inventory/server): return inventory if it's a table
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Jan 1, 2022
1 parent 9689a12 commit 484327f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/inventory/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ local Inventories = {}
setmetatable(Inventory, {
__call = function(self, arg)
if arg then
local inventory = Inventories[arg]
return inventory and inventory or type(arg) == 'table' and arg
if arg and type(arg) == 'table' then
return arg
end
return Inventories[arg]
end
return self
end
Expand Down Expand Up @@ -411,7 +413,7 @@ exports('SetMetadata', Inventory.SetMetadata)
-- ```
function Inventory.AddItem(inv, item, count, metadata, slot, cb)
if type(item) ~= 'table' then item = Items(item) end
inv = Inventory(inv)
if type(inv) ~= 'table' then inv = Inventory(inv) end
count = math.floor(count + 0.5)
local success, reason = false, nil
if item then
Expand Down

0 comments on commit 484327f

Please sign in to comment.