Max 5 API Reference

Table Access
[Miscellaneous]

You can use these functions to access named table objects. More...

Collaboration diagram for Table Access:

Functions

short table_get (t_symbol *s, long ***hp, long *sp)
 Get a handle to the data in a named table object.
short table_dirty (t_symbol *s)
 Mark a table object as having changed data.

Detailed Description

You can use these functions to access named table objects.

Tables have names when the user creates a table with an argument.

The scenario for knowing the name of a table but not the object itself is if you were passed a t_symbol, either as an argument to your creation function or in some message, with the implication being "do your thing with the data in the table named norris."


Function Documentation

short table_dirty ( t_symbol s  ) 

Mark a table object as having changed data.

Parameters:
s Symbol containing the name of a table object.
Returns:
If no table is associated with tableName, table_dirty returns a non-zero result.
short table_get ( t_symbol s,
long ***  hp,
long *  sp 
)

Get a handle to the data in a named table object.

Parameters:
s Symbol containing the name of the table object to find.
hp Address of a handle where the table‚Äôs data will be returned if the named table object is found.
sp Number of elements in the table (its size in longs).
Returns:
If no table object is associated with the symbol tableName, table_get() returns a non-zero result.
Remarks:
table_get searches for a table associated with the t_symbol tableName. If one is found, a Handle to its elements (stored as an array of long integers) is returned and the function returns 0. Never count on a table to exist across calls to one of your methods. Call table_get and check the result each time you wish to use a table.

Here is an example of retrieving the 40th element of a table:

    long **storage,size,value; 
    if (!table_get(gensym("somename"),&storage,&size)) { 
        if (size > 40) 
            value = *((*storage)+40); 
    }

Copyright © 2008, Cycling '74