examples: shorten the periodic output of examples/hot_reload/message.v

This commit is contained in:
Delyan Angelov 2025-03-08 14:02:35 +02:00
parent 4877417adf
commit e475e9d437
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED

View file

@ -7,19 +7,23 @@ import v.live
struct App { struct App {
mut: mut:
x int x int
counter int c int
} }
@[live] @[live]
fn print_message(mut app App) { fn print_message(mut app App) {
i := live.info() i := live.info()
println('OK reloads: ${i.reloads_ok:4d} | Total reloads: ${i.reloads:4d} | Hello! Modify this message while the program is running. app: ${voidptr(app)} | app.x: ${app.x:6} | app.counter: ${app.counter:6}') println('Hello! Modify this message. OK reloads: ${i.reloads_ok:2d} | Total: ${i.reloads:2d} | app: ${voidptr(app)} | app.c: ${app.c:4} | app.x: ${app.x:12}')
// app.x = 99 // try changing this to another value, while the program is running ... // app.x = app.x * 3 + 1 // try changing this to another value, while the program is running ...
app.counter++ // app.x = 0
app.c++
} }
fn main() { fn main() {
unbuffer_stdout() unbuffer_stdout()
println('=============================================================')
println('== Modify the message below, while the program is running: ==')
println('=============================================================')
mut app := &App{} mut app := &App{}
for { for {
print_message(mut app) print_message(mut app)