I'm using ChaiScript for a simple game engine project that I'm working on at the moment. I have a basic scripting system implemented so far, where each entity can have a script attached to it, and each entity gets a separate ChaiScript object. I would like to add a feature so that a script can call a function that is inside another script, example:
In one script I could have:
def someFunction() {
return 1 + 2;
}
And then in another script I want to be able to do the following (I already have FindEntity set up and working):
// Call someFunction, that is defined in the script attached to "Some Entity"
FindEntity("Some Entity").GetScript().someFunction();
How would this be done, if it is possible?
I'm using ChaiScript for a simple game engine project that I'm working on at the moment. I have a basic scripting system implemented so far, where each entity can have a script attached to it, and each entity gets a separate ChaiScript object. I would like to add a feature so that a script can call a function that is inside another script, example:
In one script I could have:
And then in another script I want to be able to do the following (I already have
FindEntityset up and working):How would this be done, if it is possible?