Set sets an item in this table at the specified index. Returns an error if the index is out of bounds.
(store Storelike, idx uint64, val Val)
| 84 | // |
| 85 | // Returns an error if the index is out of bounds. |
| 86 | func (t *Table) Set(store Storelike, idx uint64, val Val) error { |
| 87 | var raw_val C.wasmtime_val_t |
| 88 | val.initialize(store, &raw_val) |
| 89 | err := C.wasmtime_table_set(store.Context(), &t.val, C.uint64_t(idx), &raw_val) |
| 90 | C.wasmtime_val_unroot(&raw_val) |
| 91 | runtime.KeepAlive(store) |
| 92 | if err != nil { |
| 93 | return mkError(err) |
| 94 | } |
| 95 | return nil |
| 96 | } |
| 97 | |
| 98 | // Type returns the underlying type of this table |
| 99 | func (t *Table) Type(store Storelike) *TableType { |