Get gets an item from this table from the specified index. Returns an error if the index is out of bounds, or returns a value (which may be internally null) if the index is in bounds corresponding to the entry at the specified index.
(store Storelike, idx uint64)
| 71 | // may be internally null) if the index is in bounds corresponding to the entry |
| 72 | // at the specified index. |
| 73 | func (t *Table) Get(store Storelike, idx uint64) (Val, error) { |
| 74 | var val C.wasmtime_val_t |
| 75 | ok := C.wasmtime_table_get(store.Context(), &t.val, C.uint64_t(idx), &val) |
| 76 | runtime.KeepAlive(store) |
| 77 | if !ok { |
| 78 | return Val{}, errors.New("index out of bounds") |
| 79 | } |
| 80 | return takeVal(store, &val), nil |
| 81 | } |
| 82 | |
| 83 | // Set sets an item in this table at the specified index. |
| 84 | // |