Explorar o código

Merge pull request #61 from zeromus/getinteger-from-bool

support sq_getinteger() for bools
Alberto Demichelis %!s(int64=9) %!d(string=hai) anos
pai
achega
f7cf119db7
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      squirrel/sqapi.cpp

+ 4 - 0
squirrel/sqapi.cpp

@@ -657,6 +657,10 @@ SQRESULT sq_getinteger(HSQUIRRELVM v,SQInteger idx,SQInteger *i)
         *i = tointeger(o);
         return SQ_OK;
     }
+    if(sq_isbool(o)) {
+        *i = SQVM::IsFalse(o)?SQFalse:SQTrue;
+        return SQ_OK;
+    }
     return SQ_ERROR;
 }