Detect if program is currently running on a Turtle or a Computer? #1858
-
|
Is there a way to automatically detect if the current program is running on a Turtle or computer? I'm attempting to set up a OOP Class system via a datapack but I need a way to distinguish turtles and computers without inputting it manually and without using peripheral.getType(), if possible obviously. Context: I suspect a possible solution having to do with the fact that only turtles/computers can see files in certain directories in the datapack files but I can piece a solution together that wouldn't result in errors. It's been difficult to find source code of projects with a similar idea of mine (with OOP Classes and such), but I'm sure its been done before. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
The if turtle then
print("On a turtle")
else
print("On something else")
end |
Beta Was this translation helpful? Give feedback.
The
turtleAPI is only present on turtles, so you can just check for its presence.