Imp.configparams

Some notes and observations on using imp.configparams.
Consider the following program:

`local out = OutputPort(“out”)

function changed() {
out.set(imp.configparams)
}

imp.configure(“configparams”, [], [out], { x = 1, y = “foo” }, changed)
changed()`

This assumes there is a Show Input node in the planner, connected to the output of the imp running this code.
If you click on the configure button of your imp, you can alter the values of x and y, and the change will be shown in the Show Input node. Note: you have to remove the focus away from the input field to effectuate the change, by clicking somewhere else. Just hitting return does not work (at least not in Firefox on Windows).

It appears that some automatic type conversions take place:
Input is first parsed as a number (decimal int or float), if it succeeds, the result is a number. Anything else will result in a literal string.

For example:
0 -> 0
a -> ‘a’
‘a’ -> ‘\‘a\’’ // quotes are escaped
1e3 -> 1000 // scientific notation is parsed as number
15e-1 -> 1.5 // float
1a -> 1 // parsed as number (everything after leading numbers is ignored, except valid scientific notation)
0x1a -> ‘0x1a’ // parsed as string, not as hexadecimal number
true -> ‘true’ // parsed as string, not as boolean

Another observation:
When downloading new code, the configparams table is not cleared. Previously defined elements and their values persist after you remove or rename them in the imp.configure() call.