Skip to content

Commit 39ec63a

Browse files
committed
Add example chaiscript.md
1 parent fd6cbbb commit 39ec63a

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

_includes/chaiscriptexample.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
``` cpp
2+
// Using ChaiScript is easy!
3+
4+
#include <chaiscript/chaicript.hpp>
5+
6+
std::string helloWorld(const std::string &t_name)
7+
{
8+
return "Hello " + t_name + "!";
9+
}
10+
11+
int main()
12+
{
13+
chaiscript::ChaiScript chai;
14+
chai.add(chaiscript::fun(&helloWorld), "helloWorld");
15+
16+
chai.eval("puts(helloWorld(\"Bob\"));");
17+
}
18+
19+
20+
21+
```

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@
3131

3232
</ul>
3333

34+
35+
{% include chaiscriptexample.md %}
36+
3437
</body>

0 commit comments

Comments
 (0)