(data...)
Declares data that automatically goes into memory when the module is initialized. It can also be used to declare passive data
that could be copied into memory manually. It can handle numbers and ASCII text data.
Syntax
(data $memory (i32.const offset) data)
(data $label data)
Parameters
$memory Optional
The memory the data will be automatically set to. Because there is only one default memory per module this is not needed.
You can set it to 0 however.
offset
The offset within memory that the data will be copy into.
$label
If the data block is passive then this is its label. It is used with the memory.init
instruction when copying data from it into memory.
data
The unchangable data that will be copied into memory. This is either hexadecimal or ASCII text.
Examples
(data (i32.const 0) "\01\F2\AB\54")
(data (i32.const 4) "Hello")
(data $companyName "Mega-Corp")