table create ...

Prev Next

Function Names

table create, table create if not existing

Description

These function create new tables without any contents (0 rows, 0 columns).
table create creates new table if they do not yet exist, or initializes existing tables
table create if not existing will not touch the tables which are already existing.

Call as: procedure or function

Restrictions

Indirect parameter passing is enabled

Parameter count

Min. 1

Parameters

No.TypeDescription
Min. 1
input
string Name of new table

Both existing and non-existing table names are allowed.

Return value

TypeDescription
numeral Number of tables created or initialized

With the function table create if not existing, tables already existing will not be counted. -1 is returned in case of memory allocation exceptions (very rare cases, if at all).

Examples

      r1[] = table create( table 1, table 2 );
      r2[] = table create if not existing( { table 2, table 4 } ); // Indirect parameter passing

      echo("count 1: ", r1[], "   count 2: ", r2[] );

      for all parameters( {table 0 .. table 5}, t[] )
      {
          print( table existing( t[] ), ", " );
      }
      echo; // new line

Output

count 1: 2   count 2: 2
false, true, true, false, true, false,
Try it yourself: Open LIB_Function_table_create.b4p in B4P_Examples.zip. Decompress before use.

See also

table clear
table initialize