emscripten-core / emscripten-core/emscripten

Documentation about Module.arguments may need to be improved

Open
#21,082 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

The current documentation about `Module.arguments` is not clear enough, see [doc](https://emscripten.org/docs/api_reference/module.html#affecting-execution). You will receive "undefined" if you use `Module.arguments` straight in prejs because the documentation doesn't indicate that you should initialize it first, for example:
```
Module['arguments'].push("-k");
Module['arguments'].push("Image");
Module['arguments'].push("-b");
Module['arguments'].push("minimal.dtb");
Module['arguments'].push("-i");
Module['arguments'].push("rootfs.cpio");
```

Initializing `Module.arguments` before utilizing it in prejs is the proper usage procedure:
```
Module['arguments'] = []
Module['arguments'].push("-k");
Module['arguments'].push("Image");
Module['arguments'].push("-b");
Module['arguments'].push("minimal.dtb");
Module['arguments'].push("-i");
Module['arguments'].push("rootfs.cpio");
```

Related to: #11239

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.