diff --git a/examples/event_handler_js/script.rhai b/examples/event_handler_js/script.rhai index 2df62003..08ab3960 100644 --- a/examples/event_handler_js/script.rhai +++ b/examples/event_handler_js/script.rhai @@ -22,11 +22,12 @@ fn start(data) { if this.value <= 0 { throw "Conditions not yet ready to start!"; } - this.bool_state = true; - this.value += parse_int(data); // Constant 'MY_CONSTANT' in custom scope is also visible! print(`MY_CONSTANT = ${MY_CONSTANT}`); + + this.value += parse_int(data); + this.bool_state = true; } /// 'end' event handler @@ -37,8 +38,8 @@ fn end(data) { if this.value > 0 { throw "Conditions not yet ready to end!"; } - this.bool_state = false; this.value = parse_int(data); + this.bool_state = false; } /// 'update' event handler diff --git a/examples/event_handler_main/script.rhai b/examples/event_handler_main/script.rhai index a42cadef..fdfbae52 100644 --- a/examples/event_handler_main/script.rhai +++ b/examples/event_handler_main/script.rhai @@ -23,7 +23,6 @@ fn start(data) { if value <= 0 { throw "Conditions not yet ready to start!"; } - bool_state = true; // Constants 'MY_CONSTANT' and 'EXTRA_CONSTANT' // in custom scope are also visible! @@ -31,6 +30,7 @@ fn start(data) { print(`EXTRA_CONSTANT = ${EXTRA_CONSTANT}`); value += parse_int(data); + bool_state = true; } /// 'end' event handler @@ -41,8 +41,8 @@ fn end(data) { if value > 0 { throw "Conditions not yet ready to end!"; } - bool_state = false; value = parse_int(data); + bool_state = false; } /// 'update' event handler diff --git a/examples/event_handler_map/script.rhai b/examples/event_handler_map/script.rhai index 1dd341e3..fd604f6d 100644 --- a/examples/event_handler_map/script.rhai +++ b/examples/event_handler_map/script.rhai @@ -28,11 +28,12 @@ fn start(data) { if state.value <= 0 { throw "Conditions not yet ready to start!"; } - state.bool_state = true; - state.value = parse_int(data); // Constant 'MY_CONSTANT' in custom scope is also visible! print(`MY_CONSTANT = ${MY_CONSTANT}`); + + state.value = parse_int(data); + state.bool_state = true; } /// 'end' event handler @@ -43,8 +44,8 @@ fn end(data) { if state.value > 0 { throw "Conditions not yet ready to end!"; } - state.bool_state = false; state.value = parse_int(data); + state.bool_state = false; } /// 'update' event handler