Edit, view, and save are different operations
int value;
int original_value;
int dirty;
int editor_open;
function editor_enter() {
original_value = value;
dirty = FALSE;
editor_open = TRUE;
}
function editor_change(delta) {
value = value + delta;
if(value < 0) value = 0;
if(value > 100) value = 100;
dirty = TRUE;
}
function editor_cancel() {
value = original_value;
dirty = FALSE;
editor_open = FALSE;
}Last updated

