Skip to content

tes3light⚓︎

A core light object. This isn't actually a light in the rendering engine, but something like a lamp or torch.

This type inherits the following: tes3item, tes3physicalObject, tes3object, tes3baseObject

Properties⚓︎

blocked⚓︎

The blocked state of the object.

Returns:

  • result (boolean)

boundingBox⚓︎

The bounding box for the object.

Returns:


canCarry⚓︎

Access to the light's flags, determining if the light can be carried.

Returns:

  • result (boolean)

color⚓︎

Read-only. Access to the light's base colors, in an array-style table of four values. The values can range from 0 to 255.

Returns:

  • result (number[])

deleted⚓︎

Read-only. The deleted state of the object.

Returns:

  • result (boolean)

disabled⚓︎

Read-only. The disabled state of the object.

Returns:

  • result (boolean)

flickers⚓︎

Access to the light's flags, determining if the light attenuation flickers.

Returns:

  • result (boolean)

flickersSlowly⚓︎

Access to the light's flags, determining if the light attenuation flickers slowly.

Returns:

  • result (boolean)

icon⚓︎

The path to the object's icon.

Returns:

  • result (string)

id⚓︎

Read-only. The unique identifier for the object.

Returns:

  • result (string)

isDynamic⚓︎

Access to the light's flags, determining if the light affects dynamically moving objects.

Returns:

  • result (boolean)

isFire⚓︎

Access to the light's flags, determining if the light represents flame.

Returns:

  • result (boolean)

isLocationMarker⚓︎

True if this object is an editor marker for a gameplay location. These include travel, intervention, prison, door, and interior north markers. Markers are invisible in-game.

Returns:

  • result (boolean)

isNegative⚓︎

Access to the light's flags, determining if the object creates darkness.

Returns:

  • result (boolean)
Example: Disabling negative lights
local function disableNegativeLights()
    for light in tes3.iterateObjects(tes3.objectType.light) do
        ---@cast light tes3light

        if light.isNegative then
            light.isOffByDefault = true
            light.radius = 0
        end
    end
end
event.register(tes3.event.initialized, disableNegativeLights)

isOffByDefault⚓︎

If true the light won't be active initially, and will only be lit when held by an actor.

Returns:

  • result (boolean)

mesh⚓︎

The path to the object's mesh.

Returns:

  • result (string)

modified⚓︎

The modification state of the object since the last save.

Returns:

  • result (boolean)

name⚓︎

The player-facing name for the object.

Returns:

  • result (string)

nextInCollection⚓︎

The next object in parent collection's list.

Returns:


objectFlags⚓︎

Read-only. The raw flags of the object.

Returns:

  • result (number)

objectType⚓︎

Read-only. The type of object. Maps to values in tes3.objectType.

Returns:


owningCollection⚓︎

The collection responsible for holding this object.

Returns:


persistent⚓︎

The persistent flag of the object.

Returns:

  • result (boolean)

previousInCollection⚓︎

The previous object in parent collection's list.

Returns:


pulses⚓︎

Access to the light's flags, determining if the light attenuation pulses.

Returns:

  • result (boolean)

pulsesSlowly⚓︎

Access to the light's flags, determining if the light attenuation pulses slowly.

Returns:

  • result (boolean)

radius⚓︎

The base radius of the light.

Returns:

  • result (number)

scale⚓︎

The object's scale. The value range is (0, 10).

Returns:

  • result (number)

sceneCollisionRoot⚓︎

The scene graph node for this object's physics collision, if its mesh has a root collision node.

Returns:


sceneNode⚓︎

The scene graph node for this object.

Returns:


script⚓︎

Read-only. The script that runs on the object.

Returns:


sound⚓︎

Read-only. The sound that runs on the object.

Returns:


sourceless⚓︎

The soruceless flag of the object.

Returns:

  • result (boolean)

sourceMod⚓︎

Read-only. The filename (including the extension) of the mod that owns this object. It has nil value if the object was anything other than loaded from an ESP or ESM file.

Returns:

  • result (string)

stolenList⚓︎

A list of actors that the object has been stolen from.

Returns:


supportsLuaData⚓︎

If true, references of this object can store temporary or persistent lua data.

Returns:

  • result (boolean)

time⚓︎

The amount of time that the light will last.

Returns:

  • result (number)

value⚓︎

The value of the object.

Returns:

  • result (number)

weight⚓︎

The weight of the object.

Returns:

  • result (number)

Methods⚓︎

__tojson⚓︎

Serializes the object to json.

local string = myObject:__tojson()

Returns:

  • string (string)

createCopy⚓︎

Creates a copy of this object.

local newObject = myObject:createCopy({ id = ..., addToObjectList = ..., sourceless = ... })

Parameters:

  • params (table)
    • id (string): Optional. The new object's ID. If one is not provided, a randomly generated one will be used.
    • addToObjectList (boolean): Default: true. If true, the object will be added to the data handler. If this is false, the new object may not have a randomly generated ID. Do not use this without knowing the implications.
    • sourceless (boolean): Default: false. If true, the object will be made sourceless, and will not be serialized to the save game. If the object is copied outside of a save game, the object will always be sourceless.

Returns:


getTimeLeft⚓︎

Gets the time remaining for a light, given a tes3itemData, tes3reference, or tes3equipmentStack.

local result = myObject:getTimeLeft(data)

Parameters:

Returns:

  • result (number)