Fix overloading for non-pointers and NULL - Lua
This commit is contained in:
parent
ec8d978995
commit
cd7772a274
4 changed files with 55 additions and 8 deletions
|
|
@ -1765,7 +1765,12 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type
|
|||
{
|
||||
swig_lua_userdata *usr;
|
||||
swig_cast_info *cast;
|
||||
if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
|
||||
/* special case: lua nil => NULL pointer */
|
||||
if (lua_isnil(L,index))
|
||||
{
|
||||
*ptr=0;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
}
|
||||
usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
|
||||
if (usr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@
|
|||
* all the runtime code for .
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%runtime "swigrun.swg"; /* Common C API type-checking code */
|
||||
%runtime "luarun.swg"; /* Lua runtime stuff */
|
||||
%runtime "swigrun.swg" /* Common C API type-checking code */
|
||||
%runtime "swigerrors.swg" /* SWIG errors */
|
||||
%runtime "luarun.swg" /* Lua runtime stuff */
|
||||
|
||||
%insert(initbeforefunc) "swiginit.swg"
|
||||
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
|
|||
// Also needed for object ptrs by const ref
|
||||
// eg A* const& ref_pointer(A* const& a);
|
||||
// found in mixed_types.i
|
||||
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE *const&($*ltype temp)
|
||||
%typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE *const&($*ltype temp)
|
||||
%{temp=($*ltype)SWIG_MustGetPtr(L,$input,$*descriptor,0,$argnum,"$symname");
|
||||
$1=($1_ltype)&temp;%}
|
||||
|
||||
|
|
@ -327,7 +327,7 @@ parameters match which function
|
|||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE & {
|
||||
void *ptr;
|
||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, 0)) {
|
||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = 1;
|
||||
|
|
@ -336,7 +336,7 @@ parameters match which function
|
|||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && {
|
||||
void *ptr;
|
||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, 0)) {
|
||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = 1;
|
||||
|
|
@ -345,7 +345,7 @@ parameters match which function
|
|||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
|
||||
void *ptr;
|
||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $&1_descriptor, 0)) {
|
||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $&1_descriptor, SWIG_POINTER_NO_NULL)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = 1;
|
||||
|
|
@ -367,7 +367,7 @@ parameters match which function
|
|||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
|
||||
{
|
||||
void *ptr;
|
||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $*descriptor, 0)) {
|
||||
if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $*descriptor, 0)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue