Find an item||doc135687

September 20, 2022

Format

 EntityTrays:find_item(item_name) 

Description

Returns the item instance based on the item name.


Parameters

Variable name type Description
item_name string Tool placement name


Value Returned

type Description
item item instance


Code Samples

On the server side of the entity templatemount script, get the item with the configuration name "myplugin/item", and output its superposition number when the item exists

local entityTrays = this:tray()                        
local item = entityTrays:find_item("myplugin/item") 
if item then
   print(item:stack_count())
end