tw.light
Side: Client
Dynamic light sources with smooth intensity and position easing transitions.
Functions
tw.light.create(coords, intensity?, rgb?, range?, ease?)
Creates a dynamic light at the given world coordinates.
| Parameter | Type | Default | Description |
|---|---|---|---|
coords | vector3 | — | World position |
intensity | number? | 1.0 | Light brightness |
rgb | table? | {255, 160, 122} | Color as {r, g, b} (0-255) |
range | number? | 10.0 | Light radius |
ease | integer? | 1000 | Easing transition duration in ms |
Returns: LightInstance — An object with methods to control the light.
LightInstance methods
:setCoords(coords)
Moves the light to new coordinates with easing.
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | New world position |
:setIntensity(intensity)
Changes the light intensity with easing.
| Parameter | Type | Description |
|---|---|---|
intensity | number | New brightness value |
:delete()
Removes the light source.
Examples
Create a campfire light
lua
local light = tw.light.create(
vec3(-301.62, 783.04, 117.75),
1.5,
{255, 140, 50},
12.0,
800
)Move a light smoothly
lua
local light = tw.light.create(vec3(100.0, 200.0, 50.0))
-- Move to a new position (eases over the configured duration)
light:setCoords(vec3(105.0, 200.0, 50.0))Dim and delete
lua
-- Dim the light
light:setIntensity(0.2)
Wait(1000)
-- Remove it
light:delete()Notes
- All property changes (position, intensity) are eased over the duration set at creation (
easeparameter). - The default color
{255, 160, 122}is a warm light salmon tone, suitable for lanterns and campfires. - Lights are rendered every frame internally — you do not need to call anything in a loop.

