Pike v8.1 release 6

Method ADT.Table.table()->create()


Method create

ADT.Table.table ADT.Table.table(array(array) table, array(string) column_names, array(mapping(string:string))|void column_types)

Description

The ADT.Table.table class takes two or three arguments:

Parameter table

The first argument is a two-dimensional array consisting of one array of columns per row. All rows must have the same number of columns as specified in column_names.

Parameter column_names

This argument is an array of column names associated with each column in the table. References by column name are case insensitive. The case used in column_names will be used when the table is displayed. A column can also be referred to by its position, starting from zero.

Parameter column_types

This is an optional array of mappings. The column type information is only used when displaying the table. Currently, only the keyword "type" is recognized. The type can be specified as "text" or "num" (numerical). Text columns are left adjusted, whereas numerical columns are right adjusted. If a mapping in the array is 0 (zero), it will be assumed to be a text column. If column_types is omitted, all columns will displayed as text.

See ADT.Table.ASCII.encode() on how to display a table.

See also

ADT.Table.ASCII.encode()