obj.Contents - originalfoo/Prison-Architect-API GitHub Wiki

##Overview

This property seems specific to Box and Stack objects and defines what's in them.

##Syntax

-- get:
local containedItem = obj.Contents

-- set:
obj.Contents = "Light"

Values:

  • <string> - a string defining the object type, for example "RemoteDoor" or "Light" etc.

##Example

-- Find and delete all boxes containing lights, in my immediate vicinity
function RemoveBoxes()
    for box, range in Pairs(this.GetNearbyObjects("Box",25) do
        if box.Contents == "Light" then
            box.Delete()
        end
    end
end

##Notes

A Box object can only contain a single unit of the specified item, whereas a Stack object can contain multiple units of the specified item. Attempting to switch the item stored in a box by calling box.Contents = <NewItem> does not seem to have any effect.

##See Also

⚠️ **GitHub.com Fallback** ⚠️