At first I wanted to use the popular ChaiScript library, Duktape or include the Lua, but due to dependencies and possible difficulties in porting to different platforms, it was decided to find a simple, minimal but powerful MIT JS lib, meets these criteria Tiny-JS. The only disadvantage of this library in the absence of support/development from the developer, but it is fairly simple code that allows you to take the support, if required.
Download Tiny-JS from the repository:
Next, add Tiny-JS headers:
#include "tiny-js/TinyJS.h" #include "tiny-js/TinyJS_Functions.h"
Add .cpp TinyJS files to build stage, then you can start writing load and run scripts.
Lib usage examples available in the repository:
An example of a class handler implementation can be found in the project SpaceJaguar:
Game script example integrated into application: