Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

local.get: Wasm-Textinstruktion

Die local.get Instruktion lädt den Wert einer lokalen Variable auf den Stack.

Probieren Sie es aus

(module
  (import "console" "log" (func $log (param i32)))
  (func $main

    (local $var i32) ;; create a local variable named $var
    (local.set $var (i32.const 10)) ;; set $var to 10
    local.get $var ;; load $var onto the stack
    call $log ;; log the result

  )
  (start $main)
)
const url = "{%wasm-url%}";
await WebAssembly.instantiateStreaming(fetch(url), { console });

Syntax

wat
;; load the value of a local variable onto the stack
local.get $val
Instruktion Binärer Opcode
local.get 0x20