[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/de/docs/WebAssembly/Reference/Variables/local.set [Back]  [Original]

local.set: Wasm-Variablenanweisung - WebAssembly | MDN

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.set: Wasm-Variablenanweisung

Die local.set Variablenanweisung setzt den Wert einer lokalen Variablen.

In diesem Artikel

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 number 2 onto the stack
i32.const 2

;; store the number 2 in the variable $val
local.set $val
Anweisung Binrer Opcode
local.set 0x21

Spezifikationen

Spezifikation
WebAssembly Core Specification
# variable-instructions

Browser-Kompatibilitt


Web Proxy Viewer  |  New URL  |  Original Page