YYC Toolbox Lua API Help

ObjectInterface

This class exposes most object properties and manipulator methods.

You can set any field of this class to an RValue, and it'll be the same as setting a variable for every instance of this object.

Example

local engine = API.GetEngine() local object = engine:GetObjectByName("obj_player") object.x = 0 -- Set x of all obj_player instances to 0 object.y = 0 -- Set y of all obj_player instances to 0 -- You can set any variable you wish.

Name

Type: string

The name of the object. Writing to this field will overwrite the object's name.

Parent

Type: ObjectInterface

The parent of the object. nil if none is present.

Flags

Type: int (bits)

The flags of the object.

Sprite

Type: int

The sprite index for the object. Writing to this field will overwrite the object's sprite.

Depth

Type: int

The depth for the object. Writing to this field will overwrite the object's depth.

Mask

Type: int

The mask of the object.

ID

Type: int

The ID of the object.

Spawn

Spawns the object in the current room.

Arguments

Name

Type

Description

x

int

The X coordinate of the object's position.

y

int

The Y coordinate of the object's position.

layer

string

The name of the layer to spawn the object in. See remarks for more information.

room

int

The index of the room to spawn the object in. See remarks for more information.

Remarks

layer

Default: 0 (int).

This parameter is ignored if the second optional parameter, room, is defined.

room

Default: current room.

Including this parameter will place the object inside the target room at X, Y and override the layer to be 0 (int).

Destroy

Destroys the last instance of the object in the current room.

Arguments

None

GetInstances

Get a table of all object instances in the current room.

Arguments

None

Returns

Type

Description

table (array of ObjectInstance)

The instances of the object in the current rom.

Last modified: 29 March 2025