Hand-written by Joseph San Nicolas, Roblox Developer
Content
Constructors
| Name | Description |
| fromUri(uri: string):Content | Returns a new Content referencing external content via the given asset URI string. SourceType is set to Uri. If uri is empty, Content.none is returned instead. |
| fromAssetId(assetId: number):Content | Returns a new Content from a numeric asset ID. Equivalent to calling fromUri("rbxassetid://" .. tostring(assetId)). If assetId is 0, Content.none is returned instead. |
| fromObject(object: Object):Content | Returns a new Content holding a strong reference to an Object, such as an EditableImage or EditableMesh. SourceType is set to Object. Throws if object is nil. |
| none | A constant, empty Content value with SourceType of None. Accessed directly as Content.none rather than called as a function. |
Code Snippet
local AssetService = game:GetService("AssetService")
local imageLabel = Instance.new("ImageLabel")
imageLabel.ImageContent = Content.fromAssetId(1234567890)
-- Content can also wrap a live Object, like an EditableImage
local editableImage = AssetService:CreateEditableImage()
imageLabel.ImageContent = Content.fromObject(editableImage)
Properties
| Name | Type | Description |
| SourceType | Enum.ContentSourceType | Indicates which of the properties below holds a non-nil value. |
| Uri | string? | The URI string if SourceType is Uri, otherwise nil. |
| Object | Object? | A reference to the Object if SourceType is Object, otherwise nil. |
| Opaque | Opaque? | A reference to the Opaque content if SourceType is Opaque, otherwise nil. |