Questions tagged [chaiscript]

ChaiScript is an embeddable scripting language inspired by JavaScript. It is designed as header-only library that is directly targeted at C++.

ChaiScript describes itself as an easy to use embedded scripting language for C++. Some key features:

  • Header only; no external library is necessary, just a C++11 compiler.
  • Thread safe by default
  • Portable; tested on 32 and 64 bit Windows, clang++ and g++
  • BSD licensed

More info:

A tiny example:

#include <chaiscript/chaiscript.hpp>

std::string helloWorld(const std::string &t_name)
{
  return "Hello " + t_name + "!";
}

int main()
{
  chaiscript::ChaiScript chai;
  chai.add(chaiscript::fun(&helloWorld), 
           "helloWorld");

  chai.eval("puts(helloWorld(\"Bob\"));");
}
48 questions
0
votes
1 answer

Chaiscript, how to convert a char to a string

I need to loop every characters of the string. Whether I use a for loop or a range, I get stuck with characters and I can't convert them back to a string. var str = "abcd" var a = str[0] var b =…
Moose1231
  • 9
  • 4
0
votes
1 answer

Including a certain header file causes errors from SFML

I'm trying to use ChaiScript with SFML for my game engine. All the SFML stuff works fine, until I include chaiscript.hpp in my game object header file. My GameObject header file looks a little like this: #include
veridis_quo_t
  • 342
  • 3
  • 14
0
votes
1 answer

How do I get ChaiScript to run under Linux and Windows with CMake?

I am working on a Student Project and we want to use ChaiSript (6.1) as scripting Language. We are using CLion and CMake on Linux and Windows. Also we are using SFML, so the whole thing has to be compiled with minGW 7.3.0 on Windows. I created a…
Felix
  • 1
0
votes
1 answer

Chaiscript string problem between Visual Studio and Xcode

I've hit a very weird bug or most probably I'm missing something. My script runs perfectly when compiled with VS 2015 but fails when I switch to Mac and use Xcode 9. The problem is, on Mac, chaiscript removes the beginning of returned strings. I…
Carl
  • 705
  • 8
  • 22
0
votes
1 answer

How can I add a global std::map to chaiscript?

I would like to pass a std::map to chaiscript. However, I'm not sure how to do this. My code is currently as follows: #include #include #include int main(int argc, char* argv[]) { …
jan.sende
  • 750
  • 6
  • 23
0
votes
1 answer

How does chaiscript handle big objects?

I am considering using chaiscript for my project. However, I have a question about performance. Maybe it has been answered already somewhere, but I couldn't find it... I have a simulation using large data structures (at least 1-2GB). Therefore, I…
jan.sende
  • 750
  • 6
  • 23
0
votes
2 answers

Using Chaiscript without dynamically loaded libraries

I'm working with Intel SGX and would like to use Chaiscript inside an enclave. SGX forbids the use of dynamically loaded libraries inside an enclave. Is there any way to use Chaiscript in such ways (I cannot compile using the "-ldl" parameter)?
0
votes
0 answers

Cannot register type in chaiscript

I want to register a type in chaiscript for transfering data from a chaiscript function to the c++ space: class Layout { std::string device_id; std::string address; std::vector bits; public: …
musicmatze
  • 4,124
  • 7
  • 33
  • 48
0
votes
1 answer

How register overloaded template member function in ChaiScript?

I have the next definition class: class MyType { public: template MyType& put(const std::string& s, T&& val); template MyType& put(size_t pos, T&& val); template
chema989
  • 3,962
  • 2
  • 20
  • 33
0
votes
1 answer

Compile error Chaiscript Visual Studio 2015 Community

The error: Error C2664 'void chaiscript::detail::Dispatch_Engine::add(const chaiscript::Type_Info &,const std::string &)': cannot convert argument 1 from 'double (__cdecl *const )(int,double)' to 'const chaiscript::Proxy_Function &' …
kungfooman
  • 4,473
  • 1
  • 44
  • 33
0
votes
1 answer

Not able to Compile ChaiScript with C++11 enabled using CMake GUI for Android

I am not able to build ChaiScript library for android. Initially I tried to built the ChaiScript for linuxMint using CMake GUI as below mentioned step Source Path + binary Path -> Configure -> Specify Generator -> Generate -> Make. It is…
Jeet
  • 1,006
  • 1
  • 14
  • 25
0
votes
2 answers

Inheritance problem when binding C++ native methods in Chaiscript

I use this code to validate some properties of a set of Qt objects in ChaiScript: /// initialize the engine boost::shared_ptr chai; chai.reset(new chaiscript::ChaiScript()); std::cout << "ChaiScript engine…
pedromateo
  • 2,965
  • 1
  • 18
  • 19
0
votes
1 answer

ChaiScript std lib on Mac / c++ looking for dll at runtime

I'm trying to integrate ChaiScript into my little Mac / c++ project. While I'm able to use it just fine by building chaiscript_stdlib.hpp / using ChaiScript chai(Std_Lib.library()), I really would like to build the library separately. However after…
benitosub
  • 123
  • 1
  • 8
0
votes
1 answer

Assign value to Chaiscript variable through user-type object gives unexpect behaviour

I've got a peculiar problem with C++ and Chaiscript, hope somebody can help me with it, and I'll try to give it as much information as it is needed. Basically, calling a c++ function defined in c++ through chaiscript, which returns a Vector2 object…
0
votes
2 answers

Binding functions with multiple arguments results in C2027

I'm using ChaiScript 5.3.1, and I'm trying to bind functions to my own class, specifically a setPosition function which can take either a Vector3 or 3 floats. The class and it's relevant methods are declared like so: class DLLExport Actor { public: …
Ilija Boshkov
  • 149
  • 2
  • 10