item replacement||doc135656

September 20, 2022


  • The class to which the function belongs:item


Replace the original item information with the specified item configuration name.


Variable name type Description
fullName string Tool placement name

Code Samples

On the server side of the player entity templatemount script, add the error when the registered player switches hand-held itemCallback, when the old and new item are not empty, overwrite the new item with the data configuration of the old item

Trigger.addHandler(this:cfg(), "HAND_ITEM_CHANGED", function(context)
    local entity = context.obj1
    local newItem = context.item
    local oldItem = context.oldItem
    if newItem and oldItem then