Rack Bus
Overview
The Rack Bus section in the cee API provides functions for inspecting rack-mounted computer module power supplies and bus states in a ComputerCraft/CC:Tweaked environment.
This section is essential for developers working on rack systems, module power monitoring, and checking whether modules are running off the rack bus rather than individual feeds. The functions provided allow for fine-grained control over how programs query the rack's electrical environment.
Calling Conventions / Prefixes
All methods within the Rack Bus section are accessed through the global cee namespace, meaning they can be invoked directly as:
local bus = cee.busInfo()
local powered = cee.isBusPowered()
These functions do not require any object instantiation and operate on the current rack bus state. They should not be confused with methods that are part of other sections like speaker or monitor, which may have their own peripheral handles.
API Reference Table
| Signature | Arguments & Types | Description |
|---|---|---|
cee.busInfo() |
None | Returns this rack's supply bus, or nil. |
cee.isBusPowered() |
None | Returns whether it is running off the bus, not own feeds. |
Lua Code Examples
Example 1: Checking Rack Bus Information
local bus = cee.busInfo()
if bus then
print("Rack bus supply is active.")
else
print("No supply bus found for this rack.")
end
Example 2: Checking if Running on Bus Power
if cee.isBusPowered() then
print("Computer is running off the rack supply bus.")
else
print("Computer is running off its own independent feed.")
end
Example 3: Monitoring Bus Power Status in a Loop
while true do
local onBus = cee.isBusPowered()
local busInfo = cee.busInfo()
print("Bus Powered:", onBus)
os.sleep(1)
end
Notes
cee.busInfo()answers questions about the rack's supply bus directly from a computer module in the rack, with no cable to a supply required.cee.isBusPowered()indicates whether the module is drawing power from the shared rack bus rather than its own dedicated feed.