new item||doc135668

September 20, 2022

Format, count)
  • The class to which the function belongs:item


Create item based on configuration name and quantity


  • The item created by this method can generally only be matched withsettle_itemuse


Variable name type Description
fullName string Tool placement name
count int Tool quantity

Value Returned

type Description
Item item instance

Code Samples

On the server side of the player entity templatemount script, get the player's tray and add item to the tray

local item ="myplugin/testItem", 1)         --Create item instance
local filterTB = {                                
local entityTrays = this:tray()                        
local trayTb = entityTrays:query_trays(filterTB)
for tid, _tray in pairs(trayTb) do
    local slot = _tray.tray:find_free()              --Get the empty slot in the tray
    _tray.tray:settle_item(slot, item)               --Add item to tray