title: SWIG-generated Lua<-->C++ Wrapper mishandling primitive types renamed by typedef
body: <p>I use SWIG to generate a C++ &lt;--> Lua wrapper for a work project.
  my main problem is, in this project at the base there exist type definitions for each platform. E.g. for Win32 there exists a header Win32Types.h where things like</p>
  
  <pre><code>typedef char Char;
  typedef char TChar;
  typedef signed int Int;
  typedef unsigned int UInt;
  typedef signed char Int8;
  typedef unsigned char UInt8;
  ...
  </code></pre>
  
  <p>are defined.
  The problem is now, with an example class like</p>
  
  <pre><code>class Named
  {
    public:
      Named();
      virtual ~Named();
  
      void setName(const Char *name);
      const Char* GetName() const;
  }
  </code></pre>
  
  <p>, the <code>setName</code>- Method generated in the SWIG-wrapper looks something like this:</p>
  
  <pre><code>static int _wrap_Named_SetName(lua_State* L) {
    int SWIG_arg = 0;
    Named *arg1 = (Named *) 0 ;
    Char *arg2 = (Char *) 0 ;
  
    SWIG_check_num_args("Named::SetName",2,2)
  
    if(!SWIG_isptrtype(L,1))
      SWIG_fail_arg("Named::SetName",1,"Named *");
  
    if(!SWIG_isptrtype(L,2)) 
      SWIG_fail_arg("Named::SetName",2,"Char const *");
  
    if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&amp;arg1,SWIGTYPE_p_Named,0))){
      SWIG_fail_ptr("Named_SetName",1,SWIGTYPE_p_Named);
    }
  
    if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&amp;arg2,SWIGTYPE_p_Char,0))){
      SWIG_fail_ptr("Named_SetName",2,SWIGTYPE_p_Char);
    }
  
    ...
  }
  </code></pre>
  
  <p>the problem here is, the wrapper tries to treat Char as just another class pointer, although it is just a char pointer renamed to Char. 
  is there any way to circumvent this behaviour?</p>
  
  <p>i tried to write a typemap like</p>
  
  <pre><code>%typemap(in) Char {
    $1 = lua_tostring($input);
  }
  </code></pre>
  
  <p>, but im not sure i did it the right way...</p>