Next: , Previous: General Data Types, Up: Extension API Description

16.4.3 Requesting Values

All of the functions that return values from gawk work in the same way. You pass in an awk_valtype_t value to indicate what kind of value you expect. If the actual value matches what you requested, the function returns true and fills in the awk_value_t result. Otherwise, the function returns false, and the val_type member indicates the type of the actual value. You may then print an error message, or reissue the request for the actual value type, as appropriate. This behavior is summarized in table-value-types-returned.

Type of Actual Value:

String Number Array Undefined
String String String false false
Number Number if can be converted, else false Number false false
Type Array false false Array false
Requested: Scalar Scalar Scalar false false
Undefined String Number Array Undefined
Value Cookie false false false false

Table 16.1: Value Types Returned