Table Access

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. More...
 
short table_dirty (t_symbol *s)
 Mark a table object as having changed data. More...
 

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
sSymbol 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
sSymbol containing the name of the table object to find.
hpAddress of a handle where the table's data will be returned if the named table object is found.
spNumber 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:

1 long **storage,size,value;
2 if (!table_get(gensym("somename"),&storage,&size)) {
3  if (size > 40)
4  value = *((*storage)+40);
5 }
  Copyright © 2015, Cycling '74