Howto:Write simple scripts in Nasal: Difference between revisions

Jump to navigation Jump to search
m
 
Line 37: Line 37:


<pre>}</pre>
<pre>}</pre>
Finally, your code should look like this:
<syntaxhighlight lang="php">
# create a new variable named "convertTemp", assign a function body to it
var convertTemp = func {
# create a new variable named "degF" and assign the value from the getprop() call to it
var degF = getprop("engines/engine[0]/egt_degf");
# create a new variable named degc and compute the value using the degF variable
var degC = (degF - 32) * 5/9;
# finally, write the result to the property tree using the setprop() call
setprop("engines/engine[0]/egt-degc", degC);
}
</syntaxhighlight>


=== Including the nasal file in the -set file ===
=== Including the nasal file in the -set file ===

Navigation menu