This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
NullSchritt's profile picture

[info]How to get the label of the current computer

Started by NullSchritt, 30 May 2013 - 11:59 PM
NullSchritt #1
Posted 31 May 2013 - 01:59 AM
Hello all, I have been currently using the ID of each computer to identify the locations that my program transports players between. However, it would allow for a lot more flexibility if the computer label could be used instead of the computer ID.

Is there a way to retrieve the current computer label as a variable? Thanks.
Spongy141 #2
Posted 31 May 2013 - 02:08 AM
Could you be more specific, from what I'm understanding from this you're teleporting players with a program? If so whats wrong with using the computers ID, to define a ID as a variable do
 local myVariableForTheComputer = 10 --The computer ID 
From there you can set it up to have your 'teleporting computers' check with a main system computer for the ID Label or something.
theoriginalbit #3
Posted 31 May 2013 - 02:17 AM
yes it is possible to get the computer's label, using os.getComputerLabel. You are also able to set the computer's label with os.setComputerLabel.
NullSchritt #4
Posted 31 May 2013 - 02:30 AM
yes it is possible to get the computer's label, using os.getComputerLabel. You are also able to set the computer's label with os.setComputerLabel.
Brilliant, thanks!