Posted 04 February 2020 - 09:08 AM
Hello, I'm trying to automatic run a script on startup, and dispatch to different logic branch according to the device type. Following is a peice of code for demo, which cannot successfully run:
I have checked the API doc but doesn't find such an API similar to `os.getDeviceType()`
Is there any solution to implement such a function?
Now I know that I can check if current device is turtle via `if turtle == nil`, but it seem not easy to distinguish a PC and a Pad.
local dt = os.getDeviceType()
if dt == "turtle" then
runTurtleScript()
elseif dt == "pc" then
runPCScript()
elseif dt == "pad" then
runPadScript()
end
I have checked the API doc but doesn't find such an API similar to `os.getDeviceType()`
Is there any solution to implement such a function?
Now I know that I can check if current device is turtle via `if turtle == nil`, but it seem not easy to distinguish a PC and a Pad.