+1  A: 

You need to add %include <std_string.i> to your SWIG module. Otherwise, it does not know how to map a Lua string to an C++ std::string.


A common problem that people encounter is that of classes/structures containing a std::string. This can be overcome by defining a typemap. For example:

%module example
%include "std_string.i"

%apply const std::string& {std::string* foo};

struct my_struct
{
  std::string foo;
};
Judge Maygarden
I do have this in my .i file; the issue appears to be that swig makes the string constant references so you can't change them.
idontwanttortfm
Fantastic, the typemap solved my problem. Thanks so much for the help!
idontwanttortfm