You can loop through all the open tables by passing a number to Data Table() and compare names.
tableIsOpen = Function( {tname},
{rv = 0, i},
For( i = 1, i < N Table() + 1 & rv == 0, i++,
If( Lowercase( Data Table( i ) << Get Name ) == Lowercase( tname ),
rv = 1
)
);
rv;
);
edit: with a "<=" option
tableIsOpen = Function( {tname},
{rv = 0, i},
For( i = 1, i <= N Table() & rv == 0, i++,
If( Lowercase( Data Table( i ) << Get Name ) == Lowercase( tname ),
rv = 1
)
);
rv;
);
(The forum software really doesn't like less than or equal, which is why I use plain less than and added 1.)