Skip to main content

sc.component

Functions for finding out which component types the computer can detect. Use them together with sc.getComponents and sc.getAllComponents.


Functions​

getComponentTypes​

sc.component.getComponentTypes()

Gets the names of all component types that computers can detect. This includes component types added by addons.

Internal component types that are hidden from computers (like registers and antennas) are not included.

Returns:

  • [ string[] ] A list of all component type names, e.g. "Displays". The order is not guaranteed.

Example:

for _, componentType in ipairs(sc.component.getComponentTypes()) do
local components = sc.getComponents(componentType)
print(componentType .. ": " .. #components)
end

Built-in component types​

These are the component types that come with ScrapComputers. Any of them can be passed to sc.getComponents.

Component typeShortcut function
Displayssc.getDisplays()
Harddrivessc.getDrives()
Hologramssc.getHolograms()
Terminalssc.getTerminals()
Radarssc.getRadars()
NetworkPortssc.getNetworkPorts()
Camerassc.getCameras()
Speakerssc.getSpeakers()
Keyboardssc.getKeyboards()
Motorssc.getMotors()
Laserssc.getLasers()
GPSssc.getGPSs()
SeatControllerssc.getSeatControllers()
Lightssc.getLights()
GravityControllerssc.getGravityControllers()
RadarWarningReceiverssc.getRadarWarningReceivers()
CollisionDetectorssc.getCollisionDetectors()
PowerComponentssc.getPowerSources()
Note:

The power source type is named PowerComponents, not PowerSources.