mirror of
https://github.com/love2d/love.git
synced 2026-08-18 03:34:23 +02:00
Add love.system.getPreferredLocales()
This commit is contained in:
@@ -101,6 +101,22 @@ int w_hasBackgroundMusic(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_getPreferredLocales(lua_State* L)
|
||||
{
|
||||
int i = 1;
|
||||
std::vector<std::string> locales = instance()->getPreferredLocales();
|
||||
|
||||
lua_createtable(L, locales.size(), 0);
|
||||
|
||||
for (const std::string& str: locales)
|
||||
{
|
||||
luax_pushstring(L, str);
|
||||
lua_rawseti(L, -2, i++);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getOS", w_getOS },
|
||||
@@ -111,6 +127,7 @@ static const luaL_Reg functions[] =
|
||||
{ "openURL", w_openURL },
|
||||
{ "vibrate", w_vibrate },
|
||||
{ "hasBackgroundMusic", w_hasBackgroundMusic },
|
||||
{ "getPreferredLocales", w_getPreferredLocales },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user