Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Runtime Docs Version 2.0.77

# LuaRenderObject - Runtime Docs

## Class LuaRenderObject

Reference to a single LuaRendering object.

## Members

destroy() |  | Destroys this object. [...]
Destroys this object. [...]
bring_to_front() |  | Reorder this object so that it is drawn in front of the already existing objects.
Reorder this object so that it is drawn in front of the already existing objects.
move_to_back() |  | Reorder this object so that it is drawn in the back of the already existing objects.
Reorder this object so that it is drawn in the back of the already existing objects.
set_dashes(dash_length, gap_length) |  | Set the length of the dashes and the length of the gaps in this line.
Set the length of the dashes and the length of the gaps in this line.
set_corners(left_top, right_bottom) |  | Set the corners of the rectangle with this id.
Set the corners of the rectangle with this id.
id | :: R uint64 | Unique identifier of this render object.
Unique identifier of this render object.
type | :: R `"text"` or `"line"` or `"circle"` or `"rectangle"` or `"arc"` or `"polygon"` or `"sprite"` or `"light"` or `"animation"` | Type of this object.
Type of this object.
surface | :: R LuaSurface | Surface this object is rendered on.
Surface this object is rendered on.
time_to_live | :: RW uint32 | Time to live of this object. [...]
Time to live of this object. [...]
blink_interval | :: RW uint16 | Blink interval of this object based on the internal "update tick". [...]
Blink interval of this object based on the internal "update tick". [...]
forces | :: R array[LuaForce]| W ForceSet? | Forces for which this object is rendered or `nil` if visible to all forces. [...]
Forces for which this object is rendered or `nil` if visible to all forces. [...]
players | :: RW array[LuaPlayer] or array[PlayerIdentification]? | Players for which this object is visible or `nil` if visible to all players. [...]
Players for which this object is visible or `nil` if visible to all players. [...]
visible | :: RW boolean | If this object is rendered to anyone at all.
If this object is rendered to anyone at all.
draw_on_ground | :: RW boolean | If this object is being drawn on the ground, under most entities and sprites. [...]
If this object is being drawn on the ground, under most entities and sprites. [...]
only_in_alt_mode | :: RW boolean | If this object is only rendered in alt-mode.
If this object is only rendered in alt-mode.
render_mode | :: RW ScriptRenderMode | Whether the object is rendered in game world or on the chart (map view). [...]
Whether the object is rendered in game world or on the chart (map view). [...]
use_target_orientation | :: RW boolean | If this object uses the target orientation.
If this object uses the target orientation.
color | :: RW Color | Color or tint of the object.
Color or tint of the object.
width | :: RW float | Width of the object. [...]
Width of the object. [...]
from | :: RW ScriptRenderTarget | Where this line is drawn from.
Where this line is drawn from.
to | :: RW ScriptRenderTarget | Where this line is drawn to.
Where this line is drawn to.
dash_length | :: RW double | Dash length of this line.
Dash length of this line.
gap_length | :: RW double | Length of the gaps in this line.
Length of the gaps in this line.
dash_offset | :: RW double | Starting offset to apply to dashes of this line. [...]
Starting offset to apply to dashes of this line. [...]
target | :: RW ScriptRenderTarget | Where this object is drawn. [...]
Where this object is drawn. [...]
orientation | :: RW RealOrientation | Orientation of this object. [...]
Orientation of this object. [...]
scale | :: RW double | Scale of the text or light.
Scale of the text or light.
text | :: RW LocalisedString | Text that is displayed by this text object.
Text that is displayed by this text object.
font | :: RW string | Font of this text.
Font of this text.
alignment | :: RW TextAlign | Alignment of this text.
Alignment of this text.
vertical_alignment | :: RW VerticalTextAlign | Vertical alignment of this text.
Vertical alignment of this text.
scale_with_zoom | :: RW boolean | If this text scales with player zoom.
If this text scales with player zoom.
use_rich_text | :: RW boolean | If this text parses rich text tags.
If this text parses rich text tags.
filled | :: RW boolean | If this circle or rectangle is filled.
If this circle or rectangle is filled.
radius | :: RW double | Radius of this circle.
Radius of this circle.
left_top | :: RW ScriptRenderTarget | Where top left corner of this rectangle is drawn.
Where top left corner of this rectangle is drawn.
right_bottom | :: RW ScriptRenderTarget | Where bottom right corner of this rectangle is drawn.
Where bottom right corner of this rectangle is drawn.
max_radius | :: RW double | Radius of the outer edge of this arc.
Radius of the outer edge of this arc.
min_radius | :: RW double | Radius of the inner edge of this arc.
Radius of the inner edge of this arc.
start_angle | :: RW float | Where this arc starts. [...]
Where this arc starts. [...]
angle | :: RW float | Angle of this arc. [...]
Angle of this arc. [...]
vertices | :: RW array[ScriptRenderTarget] | Vertices of this polygon.
Vertices of this polygon.
sprite | :: RW SpritePath | Sprite of the sprite or light.
Sprite of the sprite or light.
x_scale | :: RW double | Horizontal scale of this sprite or animation.
Horizontal scale of this sprite or animation.
y_scale | :: RW double | Vertical scale of this sprite or animation.
Vertical scale of this sprite or animation.
render_layer | :: RW RenderLayer | Render layer of this sprite or animation.
Render layer of this sprite or animation.
orientation_target | :: RW ScriptRenderTarget? | Target to which this object rotates so that it faces the target. [...]
Target to which this object rotates so that it faces the target. [...]
oriented_offset | :: RW Vector | Offsets the center of the sprite or animation if `orientation_target` is given. [...]
Offsets the center of the sprite or animation if `orientation_target` is given. [...]
intensity | :: RW float | Intensity of this light.
Intensity of this light.
minimum_darkness | :: RW float | Minimum darkness at which this light is rendered.
Minimum darkness at which this light is rendered.
oriented | :: RW boolean | If this light is rendered with the same orientation as the target entity. [...]
If this light is rendered with the same orientation as the target entity. [...]
animation | :: RW string | Animation prototype name of this animation.
Animation prototype name of this animation.
animation_speed | :: RW double | Animation speed of this animation. [...]
Animation speed of this animation. [...]
animation_offset | :: RW double | Animation offset of this animation. [...]
Animation offset of this animation. [...]
valid | :: R boolean | Is this object valid? [...]
Is this object valid? [...]
object_name | :: R string | The class name of this object. [...]
The class name of this object. [...]

## Methods

### destroy()

Destroys this object. Does not error when the object is invalid.

### bring_to_front()

Reorder this object so that it is drawn in front of the already existing objects.

### move_to_back()

Reorder this object so that it is drawn in the back of the already existing objects.

### set_dashes(dash_length, gap_length)

Set the length of the dashes and the length of the gaps in this line.

#### Parameters

dash_length | :: double |
gap_length | :: double |

Can only be used if this is Line

### set_corners(left_top, right_bottom)

Set the corners of the rectangle with this id.

#### Parameters

left_top | :: ScriptRenderTarget |
right_bottom | :: ScriptRenderTarget |

Can only be used if this is Rectangle

## Attributes

### id :: Read uint64

Unique identifier of this render object.

### type :: Read `"text"` or `"line"` or `"circle"` or `"rectangle"` or `"arc"` or `"polygon"` or `"sprite"` or `"light"` or `"animation"`

Type of this object.

### surface :: Read LuaSurface

Surface this object is rendered on.

### time_to_live :: Read|Write uint32

Time to live of this object. This will be 0 if the object does not expire.

### blink_interval :: Read|Write uint16

Blink interval of this object based on the internal "update tick". When zero, blinking is disabled. For other values, the object will be visible the given number of ticks and then invisible for the same duration. Objects with the same blink interval will blink synchronously. Blink interval of game alerts is 30.

For example, when the interval is 60, the object is visible for 60 ticks and hidden for the next 60.

### forces :: Read array[LuaForce]| Write ForceSet?

Forces for which this object is rendered or `nil` if visible to all forces. Writing `nil` or empty array will make this object visible to all forces.

### players :: Read|Write array[LuaPlayer] or array[PlayerIdentification]?

Players for which this object is visible or `nil` if visible to all players. Writing `nil` or empty array will make this object visible to all players.

### visible :: Read|Write boolean

If this object is rendered to anyone at all.

### draw_on_ground :: Read|Write boolean

If this object is being drawn on the ground, under most entities and sprites.

In render_mode == "chart", this value is unused.

Can only be used if this is Text or Line or Circle or Rectangle or Arc or Polygon

### only_in_alt_mode :: Read|Write boolean

If this object is only rendered in alt-mode.

### render_mode :: Read|Write ScriptRenderMode

Whether the object is rendered in game world or on the chart (map view).

When it is changed, the object is pushed to front of its new group.

### use_target_orientation :: Read|Write boolean

If this object uses the target orientation.

Can only be used if this is Sprite or Polygon or Animation

### color :: Read|Write Color

Color or tint of the object.

Can only be used if this is Text or Line or Circle or Rectangle or Arc or Polygon or Sprite or Light or Animation

### width :: Read|Write float

Width of the object. Value is in pixels (32 per tile).

Can only be used if this is Line or Circle or Rectangle

### from :: Read|Write ScriptRenderTarget

Where this line is drawn from.

Can only be used if this is Line

### to :: Read|Write ScriptRenderTarget

Where this line is drawn to.

Can only be used if this is Line

### dash_length :: Read|Write double

Dash length of this line.

Can only be used if this is Line

### gap_length :: Read|Write double

Length of the gaps in this line.

Can only be used if this is Line

### dash_offset :: Read|Write double

Starting offset to apply to dashes of this line. Cannot be greater than dash_length + gap_length.

Can only be used if this is Line

### target :: Read|Write ScriptRenderTarget

Where this object is drawn.

Polygon vertices that are set to an entity will ignore this.

Can only be used if this is Text or Circle or Arc or Polygon or Sprite or Light or Animation

### orientation :: Read|Write RealOrientation

Orientation of this object.

Polygon vertices that are set to an entity will ignore this.

Can only be used if this is Text or Polygon or Sprite or Light or Animation

### scale :: Read|Write double

Scale of the text or light.

Can only be used if this is Text or Light

### text :: Read|Write LocalisedString

Text that is displayed by this text object.

Can only be used if this is Text

### font :: Read|Write string

Font of this text.

Can only be used if this is Text

### alignment :: Read|Write TextAlign

Alignment of this text.

Can only be used if this is Text

### vertical_alignment :: Read|Write VerticalTextAlign

Vertical alignment of this text.

Can only be used if this is Text

### scale_with_zoom :: Read|Write boolean

If this text scales with player zoom.

Can only be used if this is Text

### use_rich_text :: Read|Write boolean

If this text parses rich text tags.

Can only be used if this is Text

### filled :: Read|Write boolean

If this circle or rectangle is filled.

Can only be used if this is Circle or Rectangle

### radius :: Read|Write double

Radius of this circle.

Can only be used if this is Circle

### left_top :: Read|Write ScriptRenderTarget

Where top left corner of this rectangle is drawn.

Can only be used if this is Rectangle

### right_bottom :: Read|Write ScriptRenderTarget

Where bottom right corner of this rectangle is drawn.

Can only be used if this is Rectangle

### max_radius :: Read|Write double

Radius of the outer edge of this arc.

Can only be used if this is Arc

### min_radius :: Read|Write double

Radius of the inner edge of this arc.

Can only be used if this is Arc

### start_angle :: Read|Write float

Where this arc starts. Angle in radian.

Can only be used if this is Arc

### angle :: Read|Write float

Angle of this arc. Angle in radian.

Can only be used if this is Arc

### vertices :: Read|Write array[ScriptRenderTarget]

Vertices of this polygon.

Can only be used if this is Polygon

### sprite :: Read|Write SpritePath

Sprite of the sprite or light.

Can only be used if this is Sprite or Light

### x_scale :: Read|Write double

Horizontal scale of this sprite or animation.

Can only be used if this is Sprite or Animation

### y_scale :: Read|Write double

Vertical scale of this sprite or animation.

Can only be used if this is Sprite or Animation

### render_layer :: Read|Write RenderLayer

Render layer of this sprite or animation.

Can only be used if this is Sprite or Animation

### orientation_target :: Read|Write ScriptRenderTarget?

Target to which this object rotates so that it faces the target. Note that `orientation` is still applied to the object. Writing `nil` will clear the orientation_target. `nil` if no target.

Polygon vertices that are set to an entity will ignore this.

Can only be used if this is Polygon or Sprite or Animation

### oriented_offset :: Read|Write Vector

Offsets the center of the sprite or animation if `orientation_target` is given. This offset will rotate together with the sprite or animation.

Can only be used if this is Sprite or Animation

### intensity :: Read|Write float

Intensity of this light.

Can only be used if this is Light

### minimum_darkness :: Read|Write float

Minimum darkness at which this light is rendered.

Can only be used if this is Light

### oriented :: Read|Write boolean

If this light is rendered with the same orientation as the target entity. Note that `orientation` is still applied to the sprite.

Can only be used if this is Light

### animation :: Read|Write string

Animation prototype name of this animation.

Can only be used if this is Animation

### animation_speed :: Read|Write double

Animation speed of this animation. Animation speed in frames per tick.

Can only be used if this is Animation

### animation_offset :: Read|Write double

Animation offset of this animation. Animation offset in frames.

Can only be used if this is Animation

### valid :: Read boolean

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

### object_name :: Read string

The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

Class used in

- LuaRendering::draw_line()
- LuaRendering::draw_text()
- LuaRendering::draw_circle()
- LuaRendering::draw_rectangle()
- LuaRendering::draw_arc()
- LuaRendering::draw_polygon()
- LuaRendering::draw_sprite()
- LuaRendering::draw_light()
- LuaRendering::draw_animation()
- LuaRendering::get_all_objects()
- LuaRendering::get_object_by_id()
- RegistrationTarget