Wasmer::Global
Inherits Wasmer::WithExtern / Reference / Object
Global stores a single value of the given GlobalType
See Also
https://webassembly.github.io/spec/core/syntax/modules.html#globals
Constructors
new(store : Store, type : GlobalType, value : Value)
Instantiates a new Global in the given Store
It takes three arguments, the Store, the GlobalType and the Value
val_type = ValueType.new(Wasmer::I32)
global_type = GlobalType.new(val_type, Wasmer::Immutable)
global = Global.new(store, global_type, Value.new(42))
Instance methods
set(value) : Nil
Sets the Global's value
It takes two arguments, value as a native Crystal value