MScriptContext

Example
MScriptContext is used to manage script functions virtually. Custom functions can be declared during a plugin initialization in c++, you can send values to the script context using pushInt, pushString, etc,and get arguments from a script call using getInteger, getString, etc.


 * 1) include 
 * 2) include "MyPlugin.h"

int myFunction(void) {   MEngine * engine = MEngine::getInstance; MScriptContext * script = engine->getScriptContext; script->pushString("Hello World !"); return 1; // return 1 because the function is sending 1 value to the context (use 0 for none, 2 for 2 values...) }

void StartPlugin(void) {   MEngine * engine = MEngine::getInstance; MScriptContext* script = engine->getScriptContext;

script->addFunction("myFunction", myFunction); }

In Lua the function will be used like this:

text = myFunction -- "Hello World !"