1"use strict";(self.webpackChunkpluto=self.webpackChunkpluto||[]).push([[3304],{559:(s,l,e)=>{e.r(l),e.d(l,{assets:()=>a,contentTitle:()=>i,default:()=>F,frontMatter:()=>o,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"Runtime Environment/WASM","title":"WASM","description":"Must be included via require.","source":"@site/docs/Runtime Environment/WASM.md","sourceDirName":"Runtime Environment","slug":"/Runtime Environment/WASM","permalink":"/docs/Runtime Environment/WASM","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Vector3","permalink":"/docs/Runtime Environment/Vector3"},"next":{"title":"XML","permalink":"/docs/Runtime Environment/XML"}}');var r=e(4848),c=e(8453);const o={},i=void 0,a={},d=[{value:"<code>wasm.instantiate</code>",id:"wasminstantiate",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns",level:4},{value:"<code>wasm.describe</code>",id:"wasmdescribe",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-1",level:4},{value:"<code>wasm.global.new</code>",id:"wasmglobalnew",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-2",level:4},{value:"<code>wasm.table.new</code>",id:"wasmtablenew",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-3",level:4},{value:"<code>wasm.memory.new</code>",id:"wasmmemorynew",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Module Class",id:"module-class",level:2},{value:"<code>call</code>",id:"call",level:3},{value:"<code>write</code>",id:"write",level:3},{value:"<code>read</code>",id:"read",level:3}];function t(s){const l={a:"a",code:"code",div:"div",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",ol:"ol",p:"p",pre:"pre",span:"span",...(0,c.R)(),...s.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.p,{children:["Must be included via ",(0,r.jsx)(l.code,{children:"require"}),"."]}),"\n",(0,r.jsx)(l.hr,{}),"\n",(0,r.jsx)(l.h3,{id:"wasminstantiate",children:(0,r.jsx)(l.code,{children:"wasm.instantiate"})}),"\n",(0,r.jsx)(l.p,{children:"Instantiates a WASM module."}),"\n",(0,r.jsx)(l.h4,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(l.ol,{children:["\n",(0,r.jsx)(l.li,{children:"The WASM binary string."}),"\n"]}),"\n",(0,r.jsx)(l.h4,{id:"returns",children:"Returns"}),"\n",(0,r.jsxs)(l.p,{children:["A ",(0,r.jsx)(l.a,{href:"#module-class",children:"module"})," instance."]}),"\n",(0,r.jsx)(l.hr,{}),"\n",(0,r.jsx)(l.h3,{id:"wasmdescribe",children:(0,r.jsx)(l.code,{children:"wasm.describe"})}),"\n",(0,r.jsx)(l.p,{children:"Lists imports and exports of a WASM module."}),"\n",(0,r.jsx)(l.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,r.jsxs)(l.ol,{children:["\n",(0,r.jsx)(l.li,{children:"The WASM binary string."}),"\n"]}),"\n",(0,r.jsx)(l.h4,{id:"returns-1",children:"Returns"}),"\n",(0,r.jsx)(l.p,{children:'A table with the keys "imports" and "exports", the values of which will be array tables, themselves containing tables with "name" and "kind" properties. "kind" will be "function", "global", "table" or "memory".'}),"\n",(0,r.jsx)(l.hr,{}),"\n",(0,r.jsx)(l.h3,{id:"wasmglobalnew",children:(0,r.jsx)(l.code,{children:"wasm.global.new"})}),"\n",(0,r.jsx)(l.p,{children:"Creates a WASM global which can be imported by one or more WASM module instance."}),"\n",(0,r.jsx)(l.h4,{id:"parameters-2",children:"Parameters"}),"\n",(0,r.jsxs)(l.ol,{children:["\n",(0,r.jsxs)(l.li,{children:["The type of the global. Can be ",(0,r.jsx)(l.code,{children:"i32"}),", ",(0,r.jsx)(l.code,{children:"i64"}),", ",(0,r.jsx)(l.code,{children:"f32"}),", ",(0,r.jsx)(l.code,{children:"f64"}),", or ",(0,r.jsx)(l.code,{children:"externref"}),", with an optional ",(0,r.jsx)(l.code,{children:"mut"})," prefix."]}),"\n",(0,r.jsx)(l.li,{children:"The initial value of the global. Defaults to 0/null."}),"\n"]}),"\n",(0,r.jsx)(l.h4,{id:"returns-2",children:"Returns"}),"\n",(0,r.jsx)(l.p,{children:"The created WASM global instance."}),"\n",(0,r.jsxs)(l.pre,{className:"shiki monokai",style:{backgroundColor:"#272822",color:"#F8F8F2"},children:[(0,r.jsx)(l.div,{className:"language-id",children:"pluto"}),(0,r.jsx)(l.div,{className:"code-container",children:(0,r.jsxs)(l.code,{children:[(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" { base64"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm } "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"require"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"*"'})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" asm "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" base64"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"decode"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"AGFzbQEAAAABCQJgAX8AYAABfwIHAQABZwN/AQMDAgABBw0CA3NldAAAA2dldAABCg0CBgAgACQACwQAIwALAAwEbmFtZQIFAgAAAQA="'}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" g "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"new"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF",fontStyle:"italic"},children:"global"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"mut i32"'}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"123"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")"})]}),(0,r.jsx)(l.div,{className:"line",children:(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"do"})}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" mod "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"instantiate"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(asm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" { ["}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'""'}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"] "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"$"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"object"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(g) })"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"print"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(mod"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:":"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"call"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"get"'}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")) "}),(0,r.jsx)(l.span,{style:{color:"#88846F"},children:"--\x3e 123"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" mod"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:":"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"call"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"set"'}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"456"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")"})]}),(0,r.jsx)(l.div,{className:"line",children:(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"end"})}),(0,r.jsx)(l.div,{className:"line",children:(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"do"})}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" mod "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"instantiate"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(asm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" { ["}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'""'}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"] "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"$"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"object"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(g) })"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"print"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(mod"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:":"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"call"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"get"'}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")) "}),(0,r.jsx)(l.span,{style:{color:"#88846F"},children:"--\x3e 456"})]}),(0,r.jsx)(l.div,{className:"line",children:(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"end"})})]})})]}),"\n",(0,r.jsx)(l.hr,{}),"\n",(0,r.jsx)(l.h3,{id:"wasmtablenew",children:(0,r.jsx)(l.code,{children:"wasm.table.new"})}),"\n",(0,r.jsx)(l.p,{children:"Creates a WASM table which can be imported by one or more WASM module instance."}),"\n",(0,r.jsx)(l.h4,{id:"parameters-3",children:"Parameters"}),"\n",(0,r.jsxs)(l.ol,{children:["\n",(0,r.jsxs)(l.li,{children:["The element type. Can be ",(0,r.jsx)(l.code,{children:"funcref"})," or ",(0,r.jsx)(l.code,{children:"externref"}),"."]}),"\n",(0,r.jsx)(l.li,{children:"The initial size of the table."}),"\n",(0,r.jsx)(l.li,{children:"The maximum size of the table. Defaults to 0x10000."}),"\n",(0,r.jsx)(l.li,{children:"Whether the table is 64-bit. Defaults to false. Note that 32-bit builds of Pluto don't support the memory64 proposal."}),"\n"]}),"\n",(0,r.jsx)(l.h4,{id:"returns-3",children:"Returns"}),"\n",(0,r.jsx)(l.p,{children:"The created WASM table instance."}),"\n",(0,r.jsx)(l.hr,{}),"\n",(0,r.jsx)(l.h3,{id:"wasmmemorynew",children:(0,r.jsx)(l.code,{children:"wasm.memory.new"})}),"\n",(0,r.jsx)(l.p,{children:"Creates a WASM memory which can be imported by one or more WASM module instance."}),"\n",(0,r.jsx)(l.h4,{id:"parameters-4",children:"Parameters"}),"\n",(0,r.jsxs)(l.ol,{children:["\n",(0,r.jsx)(l.li,{children:"The initial size of the memory, in pages (1 page = 0x10000 bytes)."}),"\n",(0,r.jsx)(l.li,{children:"The maximum size of the memory, in pages. Defaults to 0x10000."}),"\n",(0,r.jsx)(l.li,{children:"Whether the memory is 64-bit. Defaults to false. Note that 32-bit builds of Pluto don't support the memory64 proposal."}),"\n"]}),"\n",(0,r.jsx)(l.h4,{id:"returns-4",children:"Returns"}),"\n",(0,r.jsx)(l.p,{children:"The created WASM memory instance."}),"\n",(0,r.jsx)(l.hr,{}),"\n",(0,r.jsx)(l.h2,{id:"module-class",children:"Module Class"}),"\n",(0,r.jsxs)(l.p,{children:["Module instances are obtained by calling ",(0,r.jsx)(l.code,{children:"wasm.instantiate"}),"."]}),"\n",(0,r.jsx)(l.h3,{id:"call",children:(0,r.jsx)(l.code,{children:"call"})}),"\n",(0,r.jsx)(l.p,{children:"Calls the named exported function, with optional arguments following the name."}),"\n",(0,r.jsxs)(l.pre,{className:"shiki monokai",style:{backgroundColor:"#272822",color:"#F8F8F2"},children:[(0,r.jsx)(l.div,{className:"language-id",children:"pluto"}),(0,r.jsx)(l.div,{className:"code-container",children:(0,r.jsxs)(l.code,{children:[(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" { base64"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm } "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"require"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"*"'})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" module "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"instantiate"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(base64"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"decode"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"AGFzbQEAAAABCAFgAn9/An9/AwIBAAcLAQdldWNfZGl2AAAKDgEMACAAIAFuIAAgAXALAAoEbmFtZQIDAQAA"'}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"))"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" Q"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" R "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" module"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:":"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"call"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"euc_div"'}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"21"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"5"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"print"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(Q) "}),(0,r.jsx)(l.span,{style:{color:"#88846F"},children:"--\x3e 4"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"print"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(R) "}),(0,r.jsx)(l.span,{style:{color:"#88846F"},children:"--\x3e 1"})]})]})})]}),"\n",(0,r.jsx)(l.h3,{id:"write",children:(0,r.jsx)(l.code,{children:"write"})}),"\n",(0,r.jsx)(l.p,{children:"Writes to the module's memory at the given offset with the given b
1inary string."}),"\n",(0,r.jsxs)(l.pre,{className:"shiki monokai",style:{backgroundColor:"#272822",color:"#F8F8F2"},children:[(0,r.jsx)(l.div,{className:"language-id",children:"pluto"}),(0,r.jsx)(l.div,{className:"code-container",children:(0,r.jsxs)(l.code,{children:[(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" { base64"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm } "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"require"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"*"'})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" module "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"instantiate"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(base64"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"decode"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"AGFzbQEAAAABBgFgAX8BfwMCAQAFAwEAAQcTAgZtZW1vcnkCAAZsb2FkMzIAAAoJAQcAIAAoAgALAAoEbmFtZQIDAQAA"'}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"))"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"print"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(module"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:":"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"call"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"load32"'}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"1"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")) "}),(0,r.jsx)(l.span,{style:{color:"#88846F"},children:"--\x3e 0"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"module"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:":"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"write"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"1"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"string"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"pack"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"I4"'}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"69"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"))"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"print"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(module"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:":"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"call"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"load32"'}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"1"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")) "}),(0,r.jsx)(l.span,{style:{color:"#88846F"},children:"--\x3e 69"})]})]})})]}),"\n",(0,r.jsx)(l.h3,{id:"read",children:(0,r.jsx)(l.code,{children:"read"})}),"\n",(0,r.jsx)(l.p,{children:"Reads from the module's memory at the given offset for the given amount of bytes and returns a binary string."}),"\n",(0,r.jsxs)(l.pre,{className:"shiki monokai",style:{backgroundColor:"#272822",color:"#F8F8F2"},children:[(0,r.jsx)(l.div,{className:"language-id",children:"pluto"}),(0,r.jsx)(l.div,{className:"code-container",children:(0,r.jsxs)(l.code,{children:[(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" { base64"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm } "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"require"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"*"'})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" imp "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" {"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" m "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"new"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF",fontStyle:"italic"},children:"memory"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"1"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" t "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"new"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF",fontStyle:"italic"},children:"table"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"funcref"'}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"1"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","})]}),(0,r.jsx)(l.div,{className:"line",children:(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"}"})}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"local"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" mod "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"="}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" wasm"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"instantiate"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" base64"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"decode"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"AGFzbQEAAAABBAFgAAACFAIDaW1wAW0CAAEDaW1wAXQBcAABAwMCAAAHEAEMc2V0LWluZGlyZWN0AAEJBwEAQQALAQAKFAIKAEEAQaQDNgIACwcAQQARAAALABQEbmFtZQEGAQADc2V0AgUCAAABAA=="'}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"$"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"object"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"(imp)"})]}),(0,r.jsx)(l.div,{className:"line",children:(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")"})}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"mod"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:":"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"call"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"set-indirect"'}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")"})]}),(0,r.jsxs)(l.div,{className:"line",children:[(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"string"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:"."}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"unpack"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#E6DB74"},children:'"I4"'}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" mod"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:":"}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"read"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:"("}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"0"}),(0,r.jsx)(l.span,{style:{color:"#9F570F"},children:","}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#AE81FF"},children:"4"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:")) "}),(0,r.jsx)(l.span,{style:{color:"#F92672"},children:"|>"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#66D9EF"},children:"print"}),(0,r.jsx)(l.span,{style:{color:"#F8F8F2"},children:" "}),(0,r.jsx)(l.span,{style:{color:"#88846F"},children:"--\x3e 420"})]})]})})]})]})}function F(s={}){const{wrapper:l}={...(0,c.R)(),...s.components};return l?(0,r.jsx)(l,{...s,children:(0,r.jsx)(t,{...s})}):t(s)}},8453:(s,l,e)=>{e.d(l,{R:()=>o,x:()=>i});var n=e(6540);const r={},c=n.createContext(r);function o(s){const l=n.useContext(c);return n.useMemo((function(){return"function"==typeof s?s(l):{...l,...s}}),[l,s])}function i(s){let l;return l=s.disableParentContext?"function"==typeof s.components?s.components(r):s.components||r:o(s.components),n.createElement(c.Provider,{value:l},s.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.