About ChaiScript

ChaiScript is the first and only scripting language designed from the ground up with C++ compatibility and modern design in mind. It is an ECMAScript-inspired, embedded functional-like language.

ChaiScript is licensed under the BSD license.

Download

Due to an increased release schedule, and the nature of ChaiScript being a header-only library, binary releases will be made less often. Previous releases can be found on github.

Version: 4.2.0 Released: 12/1/2012
(Requires Boost)
Source (tar.bz2)
Source (zip)

Version: 5.2.0 Released: 12/1/2012
(Requires C++11 Compiler)
Source (tar.bz2)
Source (zip)

swap the engine state

Hello,

I understand that get_state and set_state can be used to switch the running context. I think it would be useful to have also a 'swap' method for the State. Maybe something like this:

void swap_state(State& s)
{
  chaiscript::detail::threading::lock_guard<chaiscript::detail::threading::recursive_mutex> l(m_use_mutex);
  chaiscript::detail::threading::shared_lock<chaiscript::detail::threading::shared_mutex> l2(m_mutex);
  m_used_files.swap(s.used_files);
  m_engine.swap_state(s.engine_state);
  m_active_loaded_modules.swap(s.active_loaded_modules);
}

Regards,
Tavi.

I'd be happy to accept a

I'd be happy to accept a patch adding this functionality. It looks like there's a few missing details from the snippet you provided here. If you are interested, fork from the git repository, add the feature and a test for it.

-Jason

Support ChaiScript by sharing it with your friends: