diff options
| -rw-r--r-- | gamemode/core/inventory/sv_invtracker.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua index 88de42e..257410b 100644 --- a/gamemode/core/inventory/sv_invtracker.lua +++ b/gamemode/core/inventory/sv_invtracker.lua @@ -207,13 +207,13 @@ end local plymeta = FindMetaTable("Player") ---A shortcut to check if a player has an item. --- Checks if a player has an item ---@metamethod player:HasItem(str) ---@tparam string str The name of the item to look for +-- Checks if a player has an item. This method will only return the position of the FIRST item found that matches. The player MAY have other items which match. +--@metamethod player:HasItem(ptr) +--@tparam (string|function) ptr If ptr is a string, looks for an item with the same name, ptr may also be a function that takes 1 argument (an item) and returns true if the item is what you're looking for. --@treturn table|false Returns the position if the player has the item, false if they don't -function plymeta:HasItem(str) +function plymeta:HasItem(ptr) for k,v in pairs(self.data.inventories) do - local p = v:Has(str) + local p = v:Has(ptr) if type(p) == "table" then return {k,p} end |
