(element...)
Declares the function references that goes into a (table...) object. This is used to initialize the table when the module is created. It is used to declare functions that will later be inserted into a table. You can also declare a passive list of function reference that are not automatically added to a table but can be copied into one manually.

Syntax

(elem $table (i32.const offset) $function1 $functionN)
(elem declare func $function1 $functionN)
(elem $passiveData func $function1 $functionN)

Parameters

$table Optional
The table where the function references are to be set. If not given then the default table is used. If used then this points to the (table...) object.
offset
The index offset within the table that the function references will be stored.
$passiveData
The label for the passive data. This will be used when copying the function references into a table.
$function1
The label of the function that will be placed into the table. Its reference, the pointer to the function, will be placed into the table, not the whole function itself.
$functionN Optional
You can have any number of function references in the element.

Examples

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

;; Set the default table with function references
(elem (i32.const 0) $add1 $add2)
;; Create table of function references
(table $table 10 funcref)

;; Create element listing function references
(elem $passiveElement func $add $sub $mul)

;; Create function
(func $setupTable
  ;; Set the offset in destination table to copy the elements to
  i32.const 0

  ;; Set the offset in source element data to copy the elements from
  i32.const 0

  ;; Set the number of elements to copy
  i32.const 3

  ;; Initialize the table with the data elements
  table.init $table $passiveElement

  ;; The 3 elements from data are also now in the table
)