ComputerCraft Archive

4.label

pocket mod-integration kepler155c github

Description

ComputerCraft OS

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/init/4.label.lua 4.label
Archive:wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-init-4-label 4.label
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-init-4-label 4.label

Usage

Run: 4.label

Tags

none

Source

View Original Source

Code Preview

local os         = _G.os
local peripheral = _G.peripheral

-- Default label
if not os.getComputerLabel() then
	local id = os.getComputerID()

	if _G.turtle then
		os.setComputerLabel('turtle_' .. id)

	elseif _G.pocket then
		os.setComputerLabel('pocket_' .. id)

	elseif _G.commands then
		os.setComputerLabel('command_' .. id)

	elseif peripheral.find('neuralInterface') then
		os.setComputerLabel('neural_' .. id)

	else
		os.setComputerLabel('computer_' .. id)
	end
end