This page documents the OpenComputers integration for RedLogic lamps.
- Dependency:
redlogic - Label:
integration-required
lamp
- Inspecting lamp color from in-world automation.
- Detecting whether a lamp is currently powered.
- Distinguishing between different RedLogic lamp variants.
The lamp component is exposed on blocks implementing ILampBlock.
- Syntax:
getLampColor(): number - Purpose: Return the lamp color as a packed RGB integer.
- Returns:
- The current lamp color value.
- Usage notes:
- You will usually want to convert this to hexadecimal for display.
- Syntax:
isLampPowered(): boolean - Purpose: Return whether the lamp is currently powered.
- Returns:
trueif the lamp is powered.falseotherwise.
- Syntax:
getLampType(): string - Purpose: Return the lamp type name reported by RedLogic.
- Returns:
- The internal lamp type enum name.
- Usage notes:
- These callbacks only inspect lamp state. They do not switch the lamp on or off.
local component = require("component")
local lamp = component.lamp
print("Type:", lamp.getLampType())
print(string.format("Color: 0x%06X", lamp.getLampColor()))
print("Powered:", lamp.isLampPowered())opencomputers-redstone-vanillaopencomputers-redstone-bundled