diff --git a/samples/test_num_exceptions.cpp b/samples/test_num_exceptions.cpp new file mode 100644 index 0000000..371d7f1 --- /dev/null +++ b/samples/test_num_exceptions.cpp @@ -0,0 +1,32 @@ +#include +#include +#include +#include + +int main( int argc , char * argv[] ) +{ + chaiscript::ChaiScript ch( chaiscript::Std_Lib::library( ) ); + + static const char script[ ] = + R""( + + class Rectangle + { + def Rectangle() { } + } + + var rect = Rectangle( ); + + )""; + + try + { + ch.eval( script ); + } + catch ( std::exception e ) + { + printf( " >>> Exception thrown: %s \n" , e.what( ) ); + } + + return 1; +}