How it works
When you launch GP the VM (virtual machine) loads all the libraries (*.gp) inside the 'runtime/lib' folder. But this is not the only way of loading those libraries, we can also use modules. Modules are objects that contains functions and classes.
The libraries loaded by the VM are loaded in the (topLevelModule) wich is the highest module in GP. We can add classes and functions to this module with the loadModuleFromString method.
To do that we need to keep some libraries in the main library folder and create some functions. The cores files are in the 'runtime/core/[core Name]/
Here is the code that loads a core (with explanations):
To ease the work of modders some functions have been added. For example because the core folder is not the same as the usual folder, trying to read a file using a relative path won't give you anything since it is not where you would except it to be. To avoid those problems I created different functions.
What might not work
- Some parts of the AppMAker may not, I need to test things.
- Packaged core as zip Files
- Config file
You can test, ask questions, improve the code, make suggestions. You can find the source code in the GP mod community Edition here https://github.com/0gp/GP-CommunityEdit ... coreLoader
Also if you have any question on how to make your custom core works.