From 271017ba9970e4220e1bd0dc83ce146afe9222a2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 24 Jun 2025 13:37:09 -0400 Subject: Add Path.has_extension() and update manpages/api docs --- api/tables.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'api/tables.md') diff --git a/api/tables.md b/api/tables.md index 580488f4..26bfe908 100644 --- a/api/tables.md +++ b/api/tables.md @@ -164,3 +164,30 @@ t.set("C", 3) = {"A"=1, "B"=2, "C"=3} ``` +## Table.with_fallback + +```tomo +Table.with_fallback : func(t: {K=V}, fallback: {K=V}? -> {K=V}) +``` + +Return a copy of a table with a different fallback table. + +Argument | Type | Description | Default +---------|------|-------------|--------- +t | `{K=V}` | The table whose fallback will be replaced. | - +fallback | `{K=V}?` | The new fallback table value. | - + +**Return:** The original table with a different fallback. + + +**Example:** +```tomo +t := {"A"=1; fallback={"B"=2}} +t2 = t.with_fallback({"B"=3"}) +>> t2["B"] += 3? +t3 = t.with_fallback(none) +>> t2["B"] += none + +``` -- cgit v1.2.3