The Croc Programming Language
Tables

Functions

word_t croc_table_new (CrocThread *t, uword_t size)
 
void croc_table_clear (CrocThread *t, word_t tab)
 

Detailed Description

Functions which operate on tables.

Function Documentation

word_t croc_table_new ( CrocThread t,
uword_t  size 
)

Creates a new empty table and pushes it onto the stack.

Parameters
sizeis available as a hint to the allocator to preallocate this many slots in the table. Use this if you know in advance how many things you'll be adding, or if you'll be adding a ton.
Returns
the stack index of the pushed value.
void croc_table_clear ( CrocThread t,
word_t  tab 
)

Removes all key-value pairs from the table at slot idx.