table.lookup_bool

BOOLtable.lookup_boolIDidSTRINGkeyBOOLdefault

Available inall subroutines.

Looks up the key key in the table id. When the key is present, its associated value will be returned. When the key is absent, the default value is returned. The default value is required.

Example

table highres BOOL {
"broadband": true,
"cable": true,
"dialup": false,
"mobile": false, # fast but expensive
"oc12": true,
"oc3": true,
"t1": false, # T1 is 1.544Mbps
"t3": true,
"satellite": true,
"wireless": true,
"xdsl": true
}
# The idea here is to decide to deliver high-resolution media by default
# when we have a sure idea that the client's connection is suitable, and
# to give lower-resolution content when we're sure it's not suitable
# (perhaps also offering a link to a high-res version in that case).
#
# See client.geo.conn_speed
declare local var.highres BOOL;
declare local var.fallback BOOL;
set var.fallback = false; # Could populate this based on some other information
set var.highres = table.lookup_bool(highres, client.geo.conn_speed, var.fallback);