SWIG 1.3 with Lua/fnptr.i generates bad type checking when dealing with a use case:
SWIGLUA_REF references in a function that has default parameters.
By default, when SWIG encounters a SWIGLUA_REF parameter, it ignores type-checking on that parameter.
In the dispatcher method for functions that are overloaded/have default parameters, it performs explicit type checking of
the form:
lua_isuserdata(L,argv[7])==0 || SWIG_ConvertPtr(L,argv[7], (void **) &ptr, SWIGTYPE_p_SWIGLUA_REF, 0)
This will kill any usage of SWIGLUA_REF in functions with default parameters.
Still reproducible with git master it seems:
This patch fixes the example here, but seems a bit of a hack as it just allows anything to be passed for this parameter, but with the lowest typecheck precedence. Ideally we should actually check for what's accepted her, though the
intypemap allows anything so maybe that's actually correct:Also really needs test coverage.