You are right. I did it from my phone, but now I am on my laptop I see the code button.
Let me try again:
I have a long lambda that I am using on multiple places.
Right now I have the same code copied, but I would like to define it once as a script and reuse it.
The lambda basically updates a global variable.
- lambda: |-
if (isnan(x)){
id(solarman_battery_iconstring) = "";
}
else if (x < 10){
id(solarman_battery_iconstring) = "";
}
else if (x < 20){
id(solarman_battery_iconstring) = "";
}
else if (x < 30){
id(solarman_battery_iconstring) = "";
}
else if (x < 40){
id(solarman_battery_iconstring) = "";
}
else if (x < 50){
id(solarman_battery_iconstring) = "";
}
else if (x < 60){
id(solarman_battery_iconstring) = "";
}
else if (x< 70){
id(solarman_battery_iconstring) = "";
}
else if (x < 80){
id(solarman_battery_iconstring) = "";
}
else if (x < 90){
id(solarman_battery_iconstring) = "";
}
else if (x < 100){
id(solarman_battery_iconstring) = "";
}
else{
id(solarman_battery_iconstring) = "";
}
I want to supply the name of the global parameter to be updated as a variable to the script. But that gives me the error as displayed