global.get
Push a variable's value onto the stack.

Syntax

global.get $label

Parameters

$label
The label name of the global variable. This can also be the index of the global variable. The value will be pushed onto the stack. The stack will contain the same data type as the variable.

Stack In

NONE

Stack Out

* The value stored in the global variable. The data type must be the same as the variable used.

Example

;; Global constant (immutable, cannot be changed)
(global $piDiv180 f64 (f64.const 0.0174533))

;; Degree to radian function
(func $degreeToRadian (param $degree f64) (result f64)
    ;; Multiple pi/180 by $degree
    global.get $piDiv180
    local.get $degree
    f64.mul

    ;; The stack contains a f64 value with radians value    
)