Skip to content

ChaiScript/ChaiScript_Extras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChaiScript Extras

User contributed wrappers and modules for ChaiScript.

Modules

  • Math: Adds common math methods to ChaiScript.
  • String ID: String hashing with string_id
  • String: Adds some extra string methods to ChaiScript strings

Math

The Math module adds some standard math functions to ChaiScript.

Install

#include "chaiscript/extras/math.hpp"
chaiscript::ChaiScript chai;
auto mathlib = chaiscript::extras::math::bootstrap();
chai.add(mathlib);

Usage

var result = cos(0.5f)

Options

Compile with one of the following flags to enable or disable features...

  • CHAISCRIPT_EXTRAS_MATH_SKIP_ADVANCED When enabled, will skip some of the advanced math functions.

String ID

Adds String ID support to ChaiScript.

Install

#include "chaiscript/extras/string_id.hpp"
auto string_idlib = chaiscript::extras::string_id::bootstrap();
chai.add(string_idlib);

String

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()

Install

#include "chaiscript/extras/string_methods.hpp"
auto stringmethods = chaiscript::extras::string_methods::bootstrap();
chai.add(stringmethods);

Usage

var input = "Hello, World!"
var output = input.replace("Hello", "Goodbye")
// => "Goodbye, World!"