Simpler way to create a SWIG typemap for a function with multiple arguments?
问题 Here's the C++ function that I want to wrap using SWIG. static void my_func(t_string name, t_string value) { do_something(name, value); } And here are the SWIG typemaps. %typemap(in) (t_string name) { if (!lua_isstring(L, $input)) { SWIG_exception(SWIG_RuntimeError, "argument mismatch: string expected"); } $1 = lua_tostring(L, $input); } %typemap(in) (t_string value) { if (!lua_isstring(L, $input)) { SWIG_exception(SWIG_RuntimeError, "argument mismatch: string expected"); } $1 = lua_tostring