The location of the tray||doc135655

September 20, 2022

Format

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

Description

Returns the ID of the backpack where the item instance is located.


Value Returned

type Description
int BackpackId


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 new item is not empty, output the ID of the backpack where it is located

Trigger.addHandler(this:cfg(), "HAND_ITEM_CHANGED", function(context)
local entity = context.obj1
local newItem = context.item
print(newItem and newItem:tid())
end)