Chai::add_global was added

Just a modification of the add_global_const. I don't see the point in
limiting the user to binding only constants to the global scope if the user
wishes to have a thread safe mutable object as a global. This was my case
anyway.
This commit is contained in:
Kim Simmons
2012-11-06 17:20:56 +01:00
parent 9832d1ce39
commit abcc6c9e3e
2 changed files with 22 additions and 0 deletions

View File

@@ -446,6 +446,12 @@ namespace chaiscript
return *this;
}
ChaiScript &add_global(const Boxed_Value &t_bv, const std::string &t_name)
{
m_engine.add_global(t_bv, t_name);
return *this;
}
/// \brief Represents the current state of the ChaiScript system. State and be saved and restored
/// \sa ChaiScript::get_state
/// \sa ChaiScript::set_state