瀏覽代碼

Joystick:getIndex now returns nil instead of -1 if the joystick isn't connected

Alex Szpakowski 12 年之前
父節點
當前提交
db1e8e762a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/modules/joystick/sdl/wrap_JoystickModule.cpp

+ 1 - 1
src/modules/joystick/sdl/wrap_JoystickModule.cpp

@@ -51,7 +51,7 @@ int w_getIndex(lua_State *L)
 	if (index >= 0)
 	if (index >= 0)
 		lua_pushinteger(L, index + 1);
 		lua_pushinteger(L, index + 1);
 	else
 	else
-		lua_pushinteger(L, -1);
+		lua_pushnil(L);
 	return 1;
 	return 1;
 }
 }