Hi,
I am working on a program, which handles a lot of objects and data. As I would be able to inject manipulations by having some kind of 'API' to my application. As the application itself does the management of the objects and such, I wonder how this can be implemented. For example, the Unity3D and Panda3D engines allow a variety of languages, such as ECMA or Python for scripting. I am not looking for a 'gaming' scripting language to put in, but pointers on how to support various scripting languages.
For the sake of argument, let's say my program has objects that are of the class Cube. A cube has class methods such as rotate, move, transform and properties like color, center, size. Now, I would like to give my user the possibility to use for example JavaScript to manipulate the object. My 'core' program however is written in Ruby.
- Would I have to write an entire package that will evaluate the user code and its syntax (as implement an own version of JavaScript) from scratch? Or are there existing packages, skeletons, frameworks, gems, etc.?
- How would I implement security to give the scripting language only to the classes that are allowed to be manipulated (for example, an attribute that marks the class as 'manipulable').
I have always wondered how Enterprise applications did this trick (and Game engines too...), so thank you for the help and feedback.