Defined in: src/wasm_engine.rs
This class defines a Webassembly module that can be later instantiated. You should cache this to speed up further instantiation.
⚠ WARNING: CALL initialize() ASAP, DO NOT USE UNINITIALIZED OBJECT!
-
TYPE_I32 = 1 -
TYPE_I64 = 2 -
TYPE_F32 = 3 -
TYPE_F64 = 4 -
TYPE_VARIANT = 6Feature gate:
object-registry-extern
Name of the module. Is empty if module does not have name.
true if module is a component.
true if module is a core module.
Compiles the Webassembly data. Data can be one of the following:
PackedByteArrayof WASM/WAT file content.Stringof WAT file.Fileobject that will be read.
Imports is a dictionary with keys is the import module name and value is
an instance of WasmModule.
NOTE: Imports is validated and failure will results in compilation error. Eceptions are made for these modules:
host: Host-defined functions.godot_object_v1: Legacy index-based Godot API (only enabled with featureobject-registry-compat).godot_object_v2: New extern-based Godot API (only enabled with featureobject-registry-extern).wasi_unstable,wasi_snapshot_preview1: WASI-related modules (only enabled with featurewasi).
Returns itself if succeed and null if failed. All errors is emitted
to the console directly and is not visible from GDScript.
Deserializes data into module.
NOTE: This is a dangerous operation
and there is no guarantee that the data is correct.
Only use output from serialize() and do not use untrusted input.
Deserializes file into module. File path is global path.
Internally it's very optimized using memory-mapping,
so prefer this over deserialize().
NOTE: This is a dangerous operation
and there is no guarantee that the data is correct.
Only use output from serialize() and do not use untrusted input.
Serializes module into byte string.
Returns all the modules it imports.
Returns all exported functions signature. The keys are names of
the functions and it's values are a dictionary with two keys,
params and results, which contains an array of WasmType values.
Returns all host function imports. It's return value format is similiar
to get_exports().
Returns true if it has an exported function with that name.
Returns the signature of exported function with that name.
Returns null if function is not found.
Returns a dictionary describing resources required to instantiate this module.
Returns a dictionary describing resources required to instantiate this module, including all of it's imports.
Instantiate module.