I'm not quite sure what you intend? You want to just define an array? If so, you just define that array in your Inline C code:
var c = E.compiledC(`
// double lookup(int)
double lut[8] = {
1,2,3,4,5,6,7,8
};
double lookup(unsigned int x)
{
return lut[x&7];
}
`);
I don't believe there are limitations on the number of items you can have in Inline C, but each one uses a JsVar to store a reference to the function, so you'll quickly use up your device's memory.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm not quite sure what you intend? You want to just define an array? If so, you just define that array in your Inline C code:
I don't believe there are limitations on the number of items you can have in Inline C, but each one uses a JsVar to store a reference to the function, so you'll quickly use up your device's memory.