Updating extern variable

 

Hey everybody. I have an indicator that changes an external variable.

eg:

in the input window --> higher = true;

the indicator changes it to false.

when i open the input window it is still on true.

is there a way to refresh the input tab?

to get the new values.

thanks

 
you have to persist the latest value when deinit() { } is called. write it into some file. then whenever your indicator loads - init() - then read the value back
 
andrewk1983:
you have to persist the latest value when deinit() { } is called. write it into some file. then whenever your indicator loads - init() - then read the value back

Depending upon what you need to persist, it may not be appropriate to depend upon the deinit() function being called.


The deinit() function is only executed on a graceful exit.


In the event of a sudden power down, deinit() will not be executed.


I get around this by writing important data to a recovery file when that data is updated, rather than doing it in deinit().


When init() is called, I inform the user (in the log and by email) whether values have been initialised by the user input panel (extern values) or overwritten by those read from the recovery file (if it is found).

 
I can take my words back. cloudbraker is right. saving state on start() {} is much more secure.
Reason: