Modules: Adding a Module
If you want to have an additional module available for your script to work with, you can add it to the Project Manager panel.
To add a module:
- In the Project Manager panel, click the Add link that is located next to the shared folder:
A dialog box appears, in which you can create a new module, select an existing one, or upload one from disk:
- To create a new module, type its name in the Create a new module field, then click Create
- To upload a module, click Browse to select the file, the click Create
- To add an existing module, select it from the Or select an existing module list box
Note: You can also add a existing module to your script by adding a
require() function call. For example, suppose that you add the following statement to your code:
This function call adds the stringutil.lua module to the shared folder in the Project Manager panel.
Tip: Be aware that
require() does not create new modules, it wil only add existing modules. If you try to add a new module you will get an error:
The solution is simple: Just add your new module (as shown above) and the error will be resolved.