File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,66 @@ User contributed wrappers for ChaiScript.
7
7
- Math: Adds common math methods to ChaiScript.
8
8
- String ID: String hashing with [ string_id] ( https://github.com/foonathan/string_id )
9
9
- String Methods: Introduces some extra string methods to ChaiScript strings
10
+
11
+ ### Math
12
+
13
+ The Math module adds some standard math functions to ChaiScript.
14
+
15
+ #### Install
16
+ ``` cpp
17
+ #include " chaiscript/extras/math.hpp"
18
+ ```
19
+ ``` cpp
20
+ chaiscript::ChaiScript chai;
21
+ auto mathlib = chaiscript::extras::math::bootstrap();
22
+ chai.add(mathlib);
23
+ ```
24
+
25
+ #### Usage
26
+
27
+ ``` chaiscript
28
+ var result = cos(0.5f)
29
+ ```
30
+
31
+ ### String ID
32
+
33
+ Adds [ String ID] ( https://github.com/foonathan/string_id ) support to ChaiScript.
34
+
35
+ #### Install
36
+
37
+ ``` cpp
38
+ #include " chaiscript/extras/string_id.hpp"
39
+ ```
40
+
41
+ ``` cpp
42
+ auto string_idlib = chaiscript::extras::string_id::bootstrap();
43
+ chai.add(string_idlib);
44
+ ```
45
+
46
+ ### String Methods
47
+
48
+ Adds various string methods to extend how strings can be used in ChaiScript:
49
+ - ` string::replace(string, string) `
50
+ - ` string::trim() `
51
+ - ` string::split(string) `
52
+ - ` string::toLowerCase() `
53
+ - ` string::toUpperCase() `
54
+
55
+ #### Install
56
+
57
+ ``` cpp
58
+ #include " chaiscript/extras/string_methods.hpp"
59
+ ```
60
+
61
+ ``` cpp
62
+ auto stringmethods = chaiscript::extras::string_methods::bootstrap();
63
+ chai.add(stringmethods);
64
+ ```
65
+
66
+ #### Usage
67
+
68
+ ``` chaiscript
69
+ var input = "Hello, World!"
70
+ var output = input.replace("Hello", "Goodbye")
71
+ // => "Goodbye, World!"
72
+ ```
You can’t perform that action at this time.
0 commit comments