Lua - Fix char pointers, wchar_t pointers and char arrays so that nil can be passed as a valid value

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11963 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-04-02 19:48:20 +00:00
commit 662084aa06
5 changed files with 41 additions and 10 deletions

View file

@ -28,13 +28,13 @@ wchar_t* str2wstr(const char* str, int len)
}
%}
%typemap( in, checkfn="lua_isstring" ) wchar_t*
%typemap(in, checkfn="SWIG_lua_isnilstring", fragment="SWIG_lua_isnilstring") wchar_t*
%{
$1 = str2wstr(lua_tostring( L, $input ),lua_strlen( L, $input ));
if ($1==0) {lua_pushfstring(L,"Error in converting to wchar (arg %d)",$input);goto fail;}
%}
%typemap( freearg ) wchar_t*
%typemap(freearg) wchar_t*
%{
free($1);
%}