2015-11-08 13:31:22 -08:00
|
|
|
^title Modules
|
|
|
|
|
|
|
|
|
|
Because Wren can be used both as an embedded scripting language, and as a
|
2015-11-09 07:42:48 -08:00
|
|
|
general purpose programming language run from the command line, the definition
|
|
|
|
|
of a "built-in" module is a little complicated. They are organized into three
|
|
|
|
|
categories:
|
2015-11-08 13:31:22 -08:00
|
|
|
|
|
|
|
|
## Core
|
|
|
|
|
|
|
|
|
|
There is one core module. It is built directly into the VM and is implicitly
|
2015-11-09 07:42:48 -08:00
|
|
|
imported by every other module. It contains the classes for the objects built
|
|
|
|
|
directly into the language itself: [numbers][], [strings][], etc.
|
2015-11-08 13:31:22 -08:00
|
|
|
|
|
|
|
|
[numbers]: core/num.html
|
|
|
|
|
[strings]: core/string.html
|
|
|
|
|
|
|
|
|
|
The core module is always available and can't be removed.
|
|
|
|
|
|
2015-11-09 07:37:06 -08:00
|
|
|
* [core](core)
|
2015-11-08 13:31:22 -08:00
|
|
|
|
|
|
|
|
## Optional
|
|
|
|
|
|
|
|
|
|
Optional modules are available in the command line Wren interpreter. When you
|
|
|
|
|
embed Wren in your own host application, you can also include them too. They are
|
|
|
|
|
written in Wren and C, but have no external dependencies, so including them in
|
|
|
|
|
your application doesn't force you to bring in any other third-party code.
|
|
|
|
|
|
2015-11-09 07:42:48 -08:00
|
|
|
At the same time, they aren't *needed* by the VM itself to function, so you can
|
|
|
|
|
disable some or all of them if you want to keep your app as small and
|
|
|
|
|
constrained as possible.
|
2015-11-08 13:31:22 -08:00
|
|
|
|
|
|
|
|
There are a couple of optional modules:
|
|
|
|
|
|
2015-11-09 07:37:06 -08:00
|
|
|
* [meta](meta)
|
|
|
|
|
* [random](random)
|
2015-11-08 13:31:22 -08:00
|
|
|
|
|
|
|
|
## CLI
|
|
|
|
|
|
|
|
|
|
The CLI modules are only available in the standalone command-line Wren
|
|
|
|
|
interpreter. They are deeply tied to [libuv][], each other, and other internals
|
2015-11-09 07:42:48 -08:00
|
|
|
of the command-line app, so can't be separated out and pulled into host
|
2015-11-08 13:31:22 -08:00
|
|
|
applications that want to embed Wren.
|
|
|
|
|
|
|
|
|
|
[libuv]: http://libuv.org
|
|
|
|
|
|
2015-11-09 07:37:06 -08:00
|
|
|
* [io](io)
|
2016-05-21 12:44:17 -07:00
|
|
|
* [os](os)
|
2015-11-09 07:37:06 -08:00
|
|
|
* [scheduler](scheduler)
|
|
|
|
|
* [timer](timer)
|