Log inGet started

sky

Updated 5 September 2026

The sky namespace — 20 functions.

globals/sky/get

sky.get() -> { [string]: any }

Get all current sky configuration as a table. Returns the same fields as sky.set accepts, plus read-only fields like material_name and type. Color values are returned as positional arrays [r, g, b].

Returns { [string]: any } — Full sky configuration table.

local cfg = sky.get(); print(cfg.time_of_day)

globals/sky/getTimeOfDay

sky.getTimeOfDay() -> number

Get the current time of day in hours (0-24).

Returns number — Current time of day.

local t = sky.getTimeOfDay()

globals/sky/preset

sky.preset(name: string)

Apply a named sky preset. Available: clear_day, sunset, sunrise, overcast, night, studio, none. Raises a Luau error for unrecognized names — wrap in pcall if uncertain.

Parameters

  • name string — Preset name (case-sensitive).
sky.preset("sunset")

globals/sky/set

sky.set(opts: SkyOpts)

Configure the sky system. All fields are optional — only provided fields are updated. Color fields accept both named {x=r, y=g, z=b} and positional {r, g, b} forms. color is an alias for solid_color.

Parameters

  • opts SkyOpts — Sky configuration properties.
sky.set({ type = "procedural", time_of_day = 14, sync_sun_to_light = true })

globals/sky/setSunDirection

sky.setSunDirection(dir: SkyColor)

Set an explicit sun direction and disable time-based sun positioning. The directional light is updated to match.

Parameters

  • dir SkyColor — Normalized sun direction vector.
sky.setSunDirection({ 0.5, -1, 0.3 })

globals/sky/setTimeOfDay

sky.setTimeOfDay(time: number)

Set the time of day (0-24 hours). 0 = midnight, 6 = sunrise, 12 = noon, 18 = sunset.

Parameters

  • time number — Time of day in hours.
sky.setTimeOfDay(18.5)

modules/sky/README

require("@builtin/modules/api/engine/sky") -- sky (also available as global 'sky')

Sky configuration — type, time of day, day/night cycle, procedural parameters, presets, explicit sun direction. Public Luau surface over the __sky Internal FFI namespace.

Usage: local sky = require("@builtin/modules/api/engine/sky") Also available as global: sky

modules/sky/get

get(): { [string]: any }

Get all current sky configuration as a table. Returns the same fields as sky.set accepts, plus read-only fields like material_name and type. Color values are returned as positional arrays [r, g, b].

local cfg = sky.get(); print(cfg.time_of_day)

modules/sky/getTimeOfDay

getTimeOfDay(): number

Get the current time of day in hours (0-24).

local t = sky.getTimeOfDay()

modules/sky/installFallback

installFallback()

Register the engine fallback sky material and install it as the engine-level fallback (rendered when a scene has no sky entity). Idempotent; requires a live renderer — the scene loader calls it.

sky.installFallback()

modules/sky/preset

preset(name: string)

Apply a named sky preset. Available: clear_day, sunset, sunrise, overcast, night, studio, none. Raises a Luau error for unrecognized names — wrap in pcall if uncertain.

Parameters

  • name string — Preset name (case-sensitive).
sky.preset("sunset")

modules/sky/set

set(opts: SkyOpts)

Configure the sky system. All fields are optional — only provided fields are updated. Color fields accept both named {x=r, y=g, z=b} and positional {r, g, b} forms. color is an alias for solid_color.

Parameters

  • opts SkyOpts — Sky configuration properties.
sky.set({ type = "procedural", time_of_day = 14, sync_sun_to_light = true })

modules/sky/setSunDirection

setSunDirection(dir: SkyColor)

Set an explicit sun direction and disable time-based sun positioning. The directional light is updated to match.

Parameters

  • dir SkyColor — Normalized sun direction vector.
sky.setSunDirection({ 0.5, -1, 0.3 })

modules/sky/setTimeOfDay

setTimeOfDay(time: number)

Set the time of day (0-24 hours). 0 = midnight, 6 = sunrise, 12 = noon, 18 = sunset.

Parameters

  • time number — Time of day in hours.
sky.setTimeOfDay(18.5)

typed/builtin//modules/api/engine/sky/sky/get

sky.get() -> { [string]: any }

Get all current sky configuration as a table. Returns the same fields as sky.set accepts, plus read-only fields like material_name and type. Color values are returned as positional arrays [r, g, b].

typed/builtin//modules/api/engine/sky/sky/getTimeOfDay

sky.getTimeOfDay() -> number

Get the current time of day in hours (0-24).

Returns number — Current time of day.

local t = sky.getTimeOfDay()

typed/builtin//modules/api/engine/sky/sky/preset

sky.preset(name: string)

Apply a named sky preset. Available: clear_day, sunset, sunrise, overcast, night, studio, none. Raises a Luau error for unrecognized names — wrap in pcall if uncertain.

Parameters

  • name string — Preset name (case-sensitive).
sky.preset("sunset")

typed/builtin//modules/api/engine/sky/sky/set

sky.set(opts: SkyOpts)

Configure the sky system. All fields are optional — only provided fields are updated. Color fields accept both named {x=r, y=g, z=b} and positional {r, g, b} forms. color is an alias for solid_color.

typed/builtin//modules/api/engine/sky/sky/setSunDirection

sky.setSunDirection(dir: SkyColor)

Set an explicit sun direction and disable time-based sun positioning. The directional light is updated to match.

Parameters

  • dir SkyColor — Normalized sun direction vector.
sky.setSunDirection({ 0.5, -1, 0.3 })

typed/builtin//modules/api/engine/sky/sky/setTimeOfDay

sky.setTimeOfDay(time: number)

Set the time of day (0-24 hours). 0 = midnight, 6 = sunrise, 12 = noon, 18 = sunset.

Parameters

  • time number — Time of day in hours.
sky.setTimeOfDay(18.5)
  • api
  • reference