Tray slot legality||doc135679

September 20, 2022

Format

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

Description

Determine whether the tray slot is valid, that is, there is no slot that exceeds the current tray capacity of the tray.


Value Returned

type Description
boolean is it effective


Parameters

Variable name type Description
slot 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, to determine whether the tray slot 1 is valid

Trigger.addHandler(this:cfg(), "SETTLE_ITEM", function(context)
    local entity = context.obj1
    local tray = context.tray
    local isValid = tray:is_valid_slot(2)
    print(isValid)
end)