charlang/example/asciiPlotRealTime.char
Copy
threadCodeT := ` param (v0) cnt := 1 plv(v0) // return for { cnt ++ if cnt > 10 { cnt = 0 } v0[0][2] = cnt plotClearConsole() pln(plotDataToStr(v0, "-caption=try press key a to z (ctrl+c to exit)...", "-min=0", "-max=30", "-height=20", "-width=60")) sleep(1.0) } return ` c1 := charCode(threadCodeT) rs1 := c1.compile() if isErr(rs1) { fatalf("failed to compile code: %v", rs1) } a := [[0, 1.2, 2, 3, 4, 5, 6]] c1.threadRun(a) for { rs := getChar() if rs == "3+0" { exit() } if strStartsWith(rs, "0+") { numT := toInt(rs[2:], 0) - 97 a[0][4] = numT } pln(rs) }