User contributed wrappers and modules for ChaiScript.
- Math: Adds common math methods to ChaiScript.
- String ID: String hashing with string_id
- String: Adds some extra string methods to ChaiScript strings
The Math module adds some standard math functions to ChaiScript.
#include "chaiscript/extras/math.hpp"chaiscript::ChaiScript chai;
auto mathlib = chaiscript::extras::math::bootstrap();
chai.add(mathlib);var result = cos(0.5f)
Compile with one of the following flags to enable or disable features...
CHAISCRIPT_EXTRAS_MATH_SKIP_ADVANCEDWhen enabled, will skip some of the advanced math functions.
Adds String ID support to ChaiScript.
#include "chaiscript/extras/string_id.hpp"auto string_idlib = chaiscript::extras::string_id::bootstrap();
chai.add(string_idlib);Adds various string methods to extend how strings can be used in ChaiScript:
string::replace(string, string)string::trim()string::trimStart()string::trimEnd()string::split(string)string::toLowerCase()string::toUpperCase()string::includes()
#include "chaiscript/extras/string_methods.hpp"auto stringmethods = chaiscript::extras::string_methods::bootstrap();
chai.add(stringmethods);var input = "Hello, World!"
var output = input.replace("Hello", "Goodbye")
// => "Goodbye, World!"