From e0fcf23dbacee8da9a615f043338422783fcb3e9 Mon Sep 17 00:00:00 2001 From: oosayeroo <98313914+oosayeroo@users.noreply.github.com> Date: Tue, 3 Jun 2025 08:52:06 +0100 Subject: [PATCH] added simple "doesItemExist(item)" function - very simple function to check existance of an item --- shared/itemcontrol.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/shared/itemcontrol.lua b/shared/itemcontrol.lua index e5dd853..df52045 100644 --- a/shared/itemcontrol.lua +++ b/shared/itemcontrol.lua @@ -797,3 +797,23 @@ else end, true) end +------------------------------------------------------------- +-- Check Item Existance - return boolean(true,false) +------------------------------------------------------------- + +--- checks whether an item exists in your item database +--- +--- @param item string The item name. +--- +--- @usage +--- ```lua +--- local item = "apple" +--- if doesItemExist(item) then print("item exists") end +--- ``` +function doesItemExist(item) + if not item or item == "" then return false end + if Items[item] ~= nil then + return true + end + return false +end \ No newline at end of file