Skip to main content

imp.info()

Returns information about the imp on which your code is running

Availability

Device (from impOS™ 36)

Returns

Squirrel meta object with a key type — its value is a string indicating the imp type

Description

This method returns a table containing information about the imp, accessed through the following keys:

Key Value Type Description
type String The type of imp: "imp001", "imp002", "imp003", "imp004m", "imp005" or "impC001"

The object returned by imp.info() is not a Squirrel table, but a ‘meta’ object. This means the returned object can’t be examined as might a table — for example, using foreach to iterate over keys and values. However, its properties are accessed in the same way, using dot syntax as shown in the example below.

For networking information, use imp.net.info(). To determine if your code is running in the impCloud™ as an agent, you can call imp.environment().

Example Code

The following code snippet shows how a customer might use imp.info() to support multiple versions of a product, each based on a different imp type, in the same application code by aliasing application peripherals to imp-specific objects.