mirror of
https://github.com/love2d/love.git
synced 2026-08-13 09:00:54 +02:00
Add Joystick:getGamepadMappingString and love.joystick.getGamepadMappingString(guid). Resolves issue #1371.
This commit is contained in:
@@ -160,6 +160,17 @@ int w_saveGamepadMappings(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_getGamepadMappingString(lua_State *L)
|
||||
{
|
||||
const char *guid = luaL_checkstring(L, 1);
|
||||
std::string mapping = instance()->getGamepadMappingString(guid);
|
||||
if (mapping.empty())
|
||||
lua_pushnil(L);
|
||||
else
|
||||
luax_pushstring(L, mapping);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
@@ -168,6 +179,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setGamepadMapping", w_setGamepadMapping },
|
||||
{ "loadGamepadMappings", w_loadGamepadMappings },
|
||||
{ "saveGamepadMappings", w_saveGamepadMappings },
|
||||
{ "getGamepadMappingString", w_getGamepadMappingString },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user