Scrappy Device is a simple library for Solar2D that allows you to get info about the device your app is running on.
As with all my plugins it is free to use however if you find it useful, and are able to, I’d appreciate a coffee.
Image Credit: Digital devices by ProSymbols from the Noun Project.
In order to use the library you will need to include it in your project, to do so please see this guide.
Initiates the library.
params ( table ) – Parameters for the initiation.
Gets the simple tag for each platform.
returns – The name of the platform. Either ‘macos’, ‘win32’, ‘android’, ‘ios’, ‘tvos’, ‘winphone’, or ‘html5’.
Gets the environment name.
returns – The name of the environment. Either ‘device’ or ‘simulator’.
Gets the model name.
returns – The name of the model.
Checks if the game is currently running on a physical device.
returns – True if it is, false otherwise.
Checks if the game is currently running in the simulator.
returns – True if it is, false otherwise.
Checks if the game is currently running on a TV based console.
returns – True if it is, false otherwise.
Checks if the game is currently running on an AppleTV.
returns – True if it is, false otherwise.
Checks if the game is currently running on an Amazon FireTV.
returns – True if it is, false otherwise.
Checks if the game is currently running on an Android TV.
returns – True if it is, false otherwise.
Checks if the game is currently running on an iOS device.
returns – True if it is, false otherwise.
Checks if the game is currently running on an Android device.
returns – True if it is, false otherwise.
Checks if the game is currently running on an OSX device.
returns – True if it is, false otherwise.
Checks if the game is currently running on a Windows device.
returns – True if it is, false otherwise.
Checks if the game is currently running on a Linux device.
returns – True if it is, false otherwise.
Checks if the game is currently running on an Amazon Kindle device.
returns – True if it is, false otherwise.
Checks if the game is currently running on a desktop.
returns – True if it is, false otherwise.
Checks if the game is currently running on a mobile device.
returns – True if it is, false otherwise.
Checks if the game is currently in a browser.
returns – True if it is, false otherwise.
Gets the name of the store that the app was built for.
returns – The name of the store.
Destroys this library.
Thank the player
if Scrappy.Device:isIOS() then print( "Thank you random player for buying an expensive phone and then quibbling over spending pennies on an app!" ) elseif Scrappy.Device:isKindle() then print( "Thank you personally for being the one user that owns a Kindle Fire." ) elseif Scrappy.Device:isAndroid() then print( "Thank you random player for buying one of about a million different variants of Android phones, this will be fun to develop for!" ) end