A pointer to the value stored for key, or null when there is none, so the value can be changed in place.
The pointer is valid until the table grows or the entry is removed. Looking up in a table that never held anything is fine and finds nothing.
counts: Table(string, int);
table_add(*counts, "a", 1);
pointer := table_find_pointer(*counts, "a");
pointer.* += 1;
assert(table_find_pointer(*counts, "a").* == 2);
assert(table_find_pointer(*counts, "b") == null);
deinit(*counts);table_find_pointer :: (table: *Table, key: table.Key_Type) -> *table.Value_Type
A pointer to the value stored for key, or null when there is none, so the value can be changed in place.
The pointer is valid until the table grows or the entry is removed. Looking up in a table that never held anything is fine and finds nothing.
Parameters
- table: *Table
- key: table.Key_Type
Returns
- *table.Value_Type
counts: Table(string, int);
table_add(*counts, "a", 1);
pointer := table_find_pointer(*counts, "a");
pointer.* += 1;
assert(table_find_pointer(*counts, "a").* == 2);
assert(table_find_pointer(*counts, "b") == null);
deinit(*counts);