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

getType()

Started by corisco1917, 03 February 2013 - 11:51 AM
corisco1917 #1
Posted 03 February 2013 - 12:51 PM
is there a know to get the type of the current console?

as if i'm running program or api from a computer or turtle?

curently im using turtle.turnLeft() which doesnt use any fuel and only turtles has it, but what i''m asking is there a better way for doing this?
KaoS #2
Posted 03 February 2013 - 12:56 PM

if turtle then
  --is turtle
elseif term.isColor() then
 --is advanced computer
else
 --is normal computer
end

the turtle API is not loaded on computers
corisco1917 #3
Posted 03 February 2013 - 01:07 PM
thanks KaoS that was really helpfull
theoriginalbit #4
Posted 03 February 2013 - 04:28 PM
to expand a little on KaoS, there is another check you could do as well

if turtle then
  -- is turtle
elseif not term.isColor then
  -- it is a CC 1.3 computer
elseif term.isColor() then
  -- it is an advanced computer
else
  -- it is a normal computer from CC 1.4
end