Get Tray Empty Slots||doc135682

September 20, 2022

Format

 tray:find_free(force) 
  • The class to which the function belongs:tray

Description

Returns a tray slot with no items placed.


Parameters

Variable name type Description
force boolean Whether to force the slot to be filled


Value Returned

type Description
int Tray slot


Code Samples

On the server side of the entity templatemount script, add the registration of this type of entity object tray when adding itemCallback, get a tray slot in the tray that has no items in it.

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