Is it possible to clear or reset a table in smartBASIC?

Tables provide associative array (or in other words lookup type) functionality within smartBASIC programs. They are typically used to allow lookup features to be implemented efficiently so that, for example, parsers can be implemented.

There does not exist a function to delete particular entries from a table, but it's possible to overwrite existing elements with TableAdd(). TableLookup() will then return the new element. However, the elements are not actually being overwritten, but marked deleted and added newly to the table, hence the table memory consumption will increase.

To fully clear a table it's possible to simply call TableInit() again.

Categories

Products