API ReferenceGE ExtensionsClient Client Lighting
Discovers and initializes lighting system backends (Advanced Lighting, Basic Lighting) with fallback logic.
Discovers and initializes lighting system backends (Advanced Lighting, Basic Lighting) with fallback logic.
| Property | Value |
|---|
| Source | lua/ge/client/lighting.lua |
| Returns | Module table M |
| Dependencies | client/lighting/*/init.lua (discovered at runtime) |
| Function | Args | Returns | Description |
|---|
M.initLightingSystems | - | - | Discovers and loads lighting backends, activates preferred manager |
M.reloadLightingSystems | - | - | Same logic as init, used for hot-reload |
- Scan
lua/ge/client/lighting/ for init.lua files (depth 1)
require() each discovered lighting backend
- Try preferred manager:
setLightManager($pref::lightManager)
- On failure, iterate
defaultLightManagerNames from settings
- If all fail:
quitWithErrorMessage("Failed to set a light manager!")
| Variable | Purpose |
|---|
$pref::lightManager | User-preferred light manager name |
| Key | Purpose |
|---|
defaultLightManagerNames | Newline-separated fallback list of light manager names |
| Function | Purpose |
|---|
setLightManager(name) | Activates a named light manager; returns success boolean |
GFXInit.getAdapterCount() | Graphics adapter count |
GFXInit.getAdapterName(i) | Check for null device |
quitWithErrorMessage(msg) | Fatal error exit |
local lighting = require("client/lighting")
lighting.initLightingSystems()
-- Hot-reload
lighting.reloadLightingSystems()
- Even with a null graphics device, the function does NOT return early (would crash later).
- Both
initLightingSystems and reloadLightingSystems have identical logic.
- The discovered backends register themselves (e.g., "Advanced Lighting", "Basic Lighting").