legality sign||doc135653

September 20, 2022

Format

 item:null() 
  • The class to which the function belongs:item

Description

Determine whether the item data exists.


Value Returned

type Description
boolean Does the data exist


Code Samples

On the server side of the player entity templatemount script, add the error when the registered player switches hand-held itemCallback, if the item data exists, output its configuration name

Trigger.addHandler(this:cfg(), "HAND_ITEM_CHANGED", function(context)
    local entity = context.obj1
    local newItem = context.item
    if not newItem:null() then
        print(newItem:full_name())
    end

  end)