max stack||doc135652

September 20, 2022


  • The class to which the function belongs:item


Get the maximum stacking number of items in the tray.

Value Returned

type Description
int max stack

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 maximum stacking number of the new item.

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