Bart van Strien avatar Bart van Strien committed fac538a

Make love.joystick 1-indexed

Comments (0)

Files changed (1)

src/modules/joystick/sdl/wrap_Joystick.cpp

 
 	int w_getName(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
+		int index = luaL_checkint(L, 1)-1;
 		lua_pushstring(L, instance->getName(index));
 		return 1;
 	}
 
 	int w_open(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
+		int index = luaL_checkint(L, 1)-1;
 		luax_pushboolean(L, instance->open(index));
 		return 1;
 	}
 
 	int w_isOpen(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
+		int index = luaL_checkint(L, 1)-1;
 		luax_pushboolean(L, instance->isOpen(index));
 		return 1;
 	}
 
 	int w_getNumAxes(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
+		int index = luaL_checkint(L, 1)-1;
 		lua_pushinteger(L, instance->getNumAxes(index));
 		return 1;
 	}
 
 	int w_getNumBalls(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
+		int index = luaL_checkint(L, 1)-1;
 		lua_pushinteger(L, instance->getNumBalls(index));
 		return 1;
 	}
 
 	int w_getNumButtons(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
+		int index = luaL_checkint(L, 1)-1;
 		lua_pushinteger(L, instance->getNumButtons(index));
 		return 1;
 	}
 
 	int w_getNumHats(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
+		int index = luaL_checkint(L, 1)-1;
 		lua_pushinteger(L, instance->getNumHats(index));
 		return 1;
 	}
 
 	int w_getAxis(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
-		int axis = luaL_checkint(L, 2);
+		int index = luaL_checkint(L, 1)-1;
+		int axis = luaL_checkint(L, 2)-1;
 		lua_pushnumber(L, instance->getAxis(index, axis));
 		return 1;
 	}
 
 	int w_isDown(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
-		int button = luaL_checkint(L, 2);
+		int index = luaL_checkint(L, 1)-1;
+		int button = luaL_checkint(L, 2)-1;
 		luax_pushboolean(L, instance->isDown(index, button));
 		return 1;
 	}
 
 	int w_getHat(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
-		int hat = luaL_checkint(L, 2);
+		int index = luaL_checkint(L, 1)-1;
+		int hat = luaL_checkint(L, 2)-1;
 
 		Joystick::Hat h = instance->getHat(index, hat);
 
 
 	int w_close(lua_State * L)
 	{
-		int index = luaL_checkint(L, 1);
+		int index = luaL_checkint(L, 1)-1;
 		instance->close(index);
 		return 0;
 	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.