table.set
Pops a function reference off the stack and sets it in a table.

Syntax

table.set $label

Parameters

$label Optional
If there is no label then the default table is used. If used then this points to a (table...) object.

Stack In

i32 The index in the table to put the function reference.
funcref A reference to a function.

Stack Out

NONE

Examples

;; Create default table of function references
(table 4 funcref)

;; Create table test function
(func $test
  ;; Create local function reference
  (local $function funcref)

  ;; Get function at index 0
  i32.const 0
  table.get
  local.set $function

  ;; Set the function at index 1
  i32.const 1
  local.get $function
  table.set

  ;; The table index 0 and 1 both point to the same function
)
;; Create labelled table of function references
(table $testTable 6 funcref)

;; Create table test function
(func $test
  ;; Create local function reference
  (local $function funcref)

  ;; Get function at index 0
  i32.const 0
  table.get $testTable
  local.set $function

  ;; Set the function at index 1
  i32.const 1
  local.get $function
  table.set $testTable

  ;; The $testTable table index 0 and 1 both point to the same function
)