binaryen.js icon indicating copy to clipboard operation
binaryen.js copied to clipboard

Please add a little bit more examples to the README

Open Dan-k391 opened this issue 2 years ago • 2 comments

I currently have a problem with what the 'ptr' param is in store function. It would be really nice if you add some other examples to the code showing just how one or two times how an api is used for similar functions. Otherwise it is really hard for users to understand all of them

Dan-k391 avatar Sep 21 '23 02:09 Dan-k391

The ptr parameter is the pointer (i.e. location in memory) that you're storing the value to. If you wanted to store 123 as a 32-bit integer to the location 456, you'd use module.i32.store(0, 0, module.i32.const(456), module.i32.const(123)).

CountBleck avatar Sep 21 '23 02:09 CountBleck

Thanks a lot, I actually remembered that I have dealt with this function before

Dan-k391 avatar Sep 21 '23 02:09 Dan-k391