Electric Imp applications are programmed for both physical hardware and cloud operation using Squirrel, a high-level, imperative and object-oriented language with garbage collection and a syntax similar to C, C++, C# and JavaScript. All Squirrel programs running on an imp will need to use at least some of the imp API — the objects and classes that encapsulate each imp, its connected hardware and its cloud-hosted agent, which mediates the device’s Internet connection. Squirrel programs may also need parts of the Squirrel standard libraries.
Electric Imp’s implementation of the language is a slightly modified form of Squirrel 3.0.4. Programmers who have used Squirrel before can read about the differences between standard Squirrel and the Electric Imp version here. Standard Squirrel is formally documented at the Squirrel web site.
The Squirrel standard library includes the following global objects with methods designed to manipulate these specific data types:
It also includes the following libraries of functions:
The documentation draws a distinction between methods and functions. Methods are functions which are part of an object itself, or a delegate object, and are thus called on the target object or data type using dot syntax:
local a = myString.tointeger();
// tointeger() is a delegate method so uses dot syntax
A function is a standalone entity and is not called using dot syntax:
local strippedString = strip(myString);
// strip() is a function so doesn't use dot syntax
Feedback via the forum is very welcome.