Browse Source

Fixed love.joystick.loadGamepadMappings to work properly if a FileData object is passed to it.

Alex Szpakowski 10 years ago
parent
commit
0d28135465
1 changed files with 9 additions and 5 deletions
  1. 9 5
      src/modules/joystick/wrap_JoystickModule.cpp

+ 9 - 5
src/modules/joystick/wrap_JoystickModule.cpp

@@ -179,13 +179,17 @@ int w_getGamepadMapping(lua_State *L)
 
 int w_loadGamepadMappings(lua_State *L)
 {
-	lua_pushvalue(L, 1);
-	luax_convobj(L, -1, "filesystem", "isFile");
-	bool isfile = luax_toboolean(L, -1);
-	lua_pop(L, 1);
-
+	bool isfile = true;
 	std::string mappings;
 
+	if (lua_isstring(L, 1))
+	{
+		lua_pushvalue(L, 1);
+		luax_convobj(L, -1, "filesystem", "isFile");
+		isfile = luax_toboolean(L, -1);
+		lua_pop(L, 1);
+	}
+
 	if (isfile)
 	{
 		love::filesystem::FileData *fd = love::filesystem::luax_getfiledata(L, 1);