aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Table.with_fallback.3
blob: 72dd0589f3544da557daaca1ceef9ca98fbfc367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Table.with_fallback 3 2025-11-29 "Tomo man-pages"
.SH NAME
Table.with_fallback \- return a table with a new fallback
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Table.with_fallback\ :\ func(t:\ {K:V},\ fallback:\ {K:V}?\ ->\ {K:V})
.fi
.SH DESCRIPTION
Return a copy of a table with a different fallback table.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx
l l l.
Name	Type	Description
t	{K:V}	The table whose fallback will be replaced. 
fallback	{K:V}?	The new fallback table value. 
.TE
.SH RETURN
The original table with a different fallback.

.SH EXAMPLES
.EX
t := {"A": 1; fallback={"B": 2}}
t2 = t.with_fallback({"B": 3"})
assert t2["B"] == 3
t3 = t.with_fallback(none)
assert t2["B"] == none
.EE
.SH SEE ALSO
.BR Tomo-Table (3)