Lua improvements - Mark Gossage patch #1295168

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7476 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-09-20 20:57:30 +00:00
commit bf48768e04
5 changed files with 442 additions and 0 deletions

17
Lib/lua/std_except.i Normal file
View file

@ -0,0 +1,17 @@
// Typemaps used by the STL wrappers that throw exceptions.
// These typemaps are used when methods are declared with an STL exception specification, such as
// size_t at() const throw (std::out_of_range);
%{
#include <stdexcept>
%}
%include "exception.i"
%typemap(throws) std::out_of_range %{
SWIG_exception(SWIG_IndexError, $1.what()); %}
%typemap(throws) std::exception %{
SWIG_exception(SWIG_SystemError, $1.what()); %}
%typemap(throws) std::exception& %{
SWIG_exception(SWIG_SystemError, ($1)->what()); %}