diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-11-01 18:21:34 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2026-02-08 12:56:07 +0100 |
| commit | 2efefaac1add693fb49c11513ab963d5c30e2c30 (patch) | |
| tree | 221accde936a8b31aad7f6947ffa116ebeface89 | |
| parent | 062d7ae3858f1e66ba1cc36574c2c5c2d337150a (diff) | |
Update example
| -rw-r--r-- | core/text/table/doc.odin | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/core/text/table/doc.odin b/core/text/table/doc.odin index 4b8d76893..29b60dbe2 100644 --- a/core/text/table/doc.odin +++ b/core/text/table/doc.odin @@ -189,12 +189,13 @@ Example: import "core:fmt" import "core:io" - import "core:os" + import os "core:os/os2" import "core:text/table" scripts :: proc(w: io.Writer) { t: table.Table table.init(&t) + defer table.destroy(&t) table.caption(&t, "Tést Suite") table.padding(&t, 1, 3) table.header_of_aligned_values(&t, {{.Left, "Script"}, {.Center, "Sample"}}) @@ -224,9 +225,7 @@ Example: } main :: proc() { - stdout := os.stream_from_handle(os.stdout) - - scripts(stdout) + scripts(os.to_stream(os.stdout)) } Output: @@ -266,14 +265,15 @@ corners and dividers. Example: package main - import "core:fmt" - import "core:io" - import "core:os" - import "core:text/table" + import "core:fmt" + import "core:io" + import os "core:os/os2" + import "core:text/table" box_drawing :: proc(w: io.Writer) { t: table.Table table.init(&t) + defer table.destroy(&t) table.caption(&t, "Box Drawing Example") table.padding(&t, 2, 2) table.header_of_aligned_values(&t, {{.Left, "Operating System"}, {.Center, "Year Introduced"}}) @@ -299,9 +299,7 @@ Example: } main :: proc() { - stdout := os.stream_from_handle(os.stdout) - - box_drawing(stdout) + box_drawing(os.to_stream(os.stdout)) } While the decorations support multi-codepoint Unicode graphemes, do note that |