-
Notifications
You must be signed in to change notification settings - Fork 126
Module (namespace)
Users may add more and more scripting interfaces to MY-BASIC, it will soon cause a naming pollution issue. It's able to separate scripting interfaces to different modules (refers to "namespace" in some other programming languages).
Use mb_begin_module
to begin a module with a module name, all functions registered after a module began will be put in that module; use mb_end_module
to end the current module. See the sample below:
mb_begin_module(s, "NAMING");
mb_register_func(s, "FOO", _foo); /* Register "foo" in module "naming" */
mb_end_module(s);
After that it's able to write naming.foo()
to call the interface.
Use IMPORT @xxx
to import a module, and all symbols in that module could be used without the module prefix. Eg. after import "@naming"
, it's able to use foo()
for short.
Read the Import another file page to get information about how import another plain source code file.
Read the Customize an importer page to get information about how to customize an importer.
- Principles
- Coding
- Data types
- Standalone shell
- Integration
- Customization
- More scripting API
- FAQ