| REBOL 3 Docs | Guide | Concepts | Functions | Datatypes | Errors |
| TOC < Back Next > | Updated: 12-Aug-2009 Edit History |
Locate, load, make, and set local bindings for module.
module [word! file! url! string! module!]
refinements:
/version
ver - Minimal version
/only
- Just return module, don't export
The import function is used to import modules into your runtime environment. For a full description see the modules: loading modules section of this documentation.
For example, you can write:
import 'mysql
and the system will search for the mysql module.
You can also use a filename or URL for the module identifier:
import %mysql.r import http://www.rebol.com/mods/mysql.r
When successful, the import function returns a module! datatype as its result.
This allows you to write:
mysql: import 'mysql
Now, the mysql variable can be used to refer to values within the mysql module.
For example the module value is used here to reference a function:
mysql/open-db %my-database.sql
See below for more.
Like the header needs field, the import function also lets you specify a version and a checksum.
These are all supported:
import/version mysql 1.2.3
import/check mysql #{A94A8FE5CCB19BA61C4C0873D391E987982FBBD3}
import/version/check mysql 1.2.3 #{A94A8FE5CCB19BA61C4C0873D391E987982FBBD3}
The benefit of using the import function compared to the needs header field is that the arguments can be variables.
A basic example is:
mod: 'mysql import mod
Or, something like:
mod-list: [
mysql 1.2.3
db-gui 2.4.5
http-server 1.0.1
]
foreach [id ver] mod-list [
import/version id ver
]
| TOC < Back Next > | REBOL.com - WIP Wiki | Feedback Admin |