GetContainerItems
A container’s contents of record.
One entry per stack: the item class GUID (GetItemName names it), how many, the item’s condition in percent. nil when
nobody has opened the container yet - its contents are still the level’s own, unknown to the server. One of the mode’s
tagged items (GivePlayerTaggedItem) a player put in is an entry of its own with its id, name and text, and it
keeps them for whoever takes it out.
Syntax
Section titled “Syntax”GetContainerItems(key)| Parameter | Type | |
|---|---|---|
key |
string | the container’s level name |
Returns
Section titled “Returns”table - a list of {class=, amount=, health=, quality=} (quality when known: an item put in keeps its own; a tagged item also id=, name=, text=); nil when never opened
Example
Section titled “Example”local items = GetContainerItems(key)if items then for _, stack in ipairs(items) do Log(GetItemName(stack.class), "x", stack.amount) endendSee also
Section titled “See also”SetContainerItems · GetContainers · OnPlayerCloseContainer · the Doors and containers group of the index
