Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 06 21:19
  • Feb 23 14:09
    Build #910 passed
  • Feb 23 14:09
    Build #910 passed
  • Feb 22 21:19
    Build #909 passed
  • Feb 22 21:19
    Build #909 passed
  • Sep 02 2021 17:24
    Build #908 passed
  • Sep 02 2021 17:24
    Build #908 passed
  • Sep 02 2021 12:25
    Build #907 passed
  • Sep 02 2021 12:25
    Build #907 passed
  • Aug 19 2021 20:06
    Build #906 passed
  • Aug 19 2021 20:06
    Build #906 passed
  • Aug 19 2021 20:00
    Build #905 passed
  • Aug 19 2021 20:00
    Build #905 passed
  • Jul 28 2021 14:10
    Build #904 passed
  • Jul 28 2021 14:10
    Build #904 passed
  • Jul 08 2021 23:59
    Build #903 passed
  • Jul 08 2021 23:59
    Build #903 passed
  • Jul 08 2021 17:04
    Build #902 passed
  • Jul 08 2021 17:04
    Build #902 passed
  • Jun 18 2021 14:53
    Build #901 passed
daneldanel
@daneldanel
Hi
6.1.0 is compatible with c++17 from VS2019?
A default console project in VS2019, append #include "chaiscript/chaiscript.hpp" in the main.cpp and build
the result: many warnings
Rebuild started...
1>------ Rebuild All started: Project: test_chai, Configuration: Debug Win32 ------
1>test_chai.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(2575,23): warning C4244: 'argument': conversion from 'const wchar_t' to 'const _Elem', possible loss of data
1> with
1> [
1> _Elem=char
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(2586): message : see reference to function template instantiation 'void std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Construct<const wchar_t*>(_Iter,const _Iter,std::input_iterator_tag)' being compiled
1> with
1> [
1> _Iter=const wchar_t
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(2586): message : see reference to function template instantiation 'void std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Construct<const wchar_t
>(_Iter,const _Iter,std::input_iterator_tag)' being compiled
1> with
1> [
1> _Iter=const wchar_t
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(2566): message : see reference to function template instantiation 'void std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Construct<const wchar_t
>(const _Iter,const _Iter,std::forward_iterator_tag)' being compiled
1> with
1> [
1> _Iter=const wchar_t
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(2566): message : see reference to function template instantiation 'void std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Construct<const wchar_t
>(const _Iter,const _Iter,std::forward_iterator_tag)' being compiled
1> with
1> [
1> _Iter=const wchar_t *
1> ]
1>D:\work\src\3rdparty\ChaiScript-6.1.0\include\chaiscript\language\chaiscript_windows.hpp(36): message : see reference to function template instantiation 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>,0>(_Iter,_Iter,const _Alloc &)' being compiled
1> with
1> [
1> _Elem=wchar_t,
1> _Iter=std::_String_const_iterator<std::_String_val<std::_Simple_types<wchar_t>>>,
1> _Alloc=std::allocator<char>
1> ]
1>D:\work\src\3rdparty\ChaiScript-6.1.0\include\chaiscript\language\chaiscript_windows.hpp(36): message : see reference to function template instantiation 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>,0>(_Iter,_Iter,const _Alloc &)' being compiled
1> with
1> [
1> _Elem=wchar_t,
1> _Iter=std::_String_const_iterator<std::_String_val<std::_Simple_types<wchar_t>>>,
1> _Alloc=std::allocator<char>
1> ]
1>D:\work\src\3rdparty\ChaiScript-6.1.0\include\chaiscript\language\chaiscript_windows.hpp(78): message : see reference to function template instantiation 'std::string chaiscript::detail::Loadable_Module::to_string<std::wstring>(const T &)' being compiled
1> with
1> [
1> T=std::wstring
1> ]
1>test_chai.vcxproj -> D:\work\src\test\test_chai\Debug\test_chai.exe
1>Done building project "test_chai.vcxproj".
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
the code is dummy:

include "chaiscript/chaiscript.hpp"

include <iostream>

int main()
{
std::cout << "Hello World!\n";
}
daneldanel
@daneldanel
for me, default settings must be with Warning Level: Level4 (/W4) and Threat Warnings as Error: true
so, the dummy project will never compile
daneldanel
@daneldanel
the problem is in static std::string get_error_message(DWORD t_err) if defined UNICODE
return to_string(retval); ehre retval is a wchar_t*
and
template<typename T>
static std::string to_string(const T &t_str)
{
return std::string(t_str.begin(), t_str.end());
}
if T=wchar_t then the result is malformed
daneldanel
@daneldanel
in Windows, for wchar_t to char conversion you must use WideCharToMultiByte and for char to wchar_t MultiByteToWideChar
NamelessHoodie
@NamelessHoodie
Is there any way in chaiscript to pass a c++ object to chaiscript. As an example as the argument for a function?
That back and forth passing of objects between cpp and the scripting language is something I really need.
Additionally, is chai script multi threaded? Is there any threading support? That's particularly important for events.
Sorry for the questions, wasn't able to deduct this information from the wiki.
namelesshoodie
@namelesshoodie:matrix.org
[m]
Well, please let me know if anyone knows anything about it.
stellarpower
@stellarpower
You can pass an object using chaiscript::var
On that note, could anytone tell me please if I can retrieve an arbitrary variable defined in the script file? If I have an object called v in the script, so far the only way I can see to do this is chai.boxed_cast<SomeType>(chai.eval("v"));
1 reply
stellarpower
@stellarpower
@namelesshoodie:matrix.org ^^ forgot to ping
stellarpower
@stellarpower
It'll do for now, at least I suppose.
And no worries
stellarpower
@stellarpower
Is there a way I can get a property of a chai object by its name (as a string), inside chai itself?
I.e.
auto x = SomeType()
auto a = x.property("count"); auto b  = x.count
print(a.to_string() + " == " + b.to_string)
stellarpower
@stellarpower
I see that the reflection module was removed some time ago. Is there some sort of alternative?
Or even just to get the type of an object? It's hard to debug dispatch issues, I have occasions when the backtrace I get from the eval exception isn't quite correct, and I also don't know what types my variables have been resolved to. I had something funky with a pair yesterday, where the instantiation hadn't been bootstrapped.