Remove tray item||doc135689

September 20, 2022

Format

 tray:remove_item(slot) 
  • The class to which the function belongs:tray

Description

Removes the item from the tray slot in the tray and returns the instance of the item removed from the tray.


Parameters

Variable name type Description
slot int Tray slot


Value Returned

type Description
Item remove item


Code Samples

On the server side of the entity templatemount script, add the registration of this type of entity object tray when adding itemCallback, remove the item in slot 1 of the tray, and output its fullName

Trigger.addHandler(this:cfg(), "SETTLE_ITEM", function(context)
    local entity = context.obj1
    local tray = context.tray
    local item = tray:remove_item(slot)
    print(item:full_name())
end)