Skip to content

Commit 8b5f257

Browse files
authored
Merge pull request scp-fs2open#1614 from asarium/feature/luaLanguageFunctions
Add lua functions for accessing the current engine language
2 parents 67c6754 + 2eea0a6 commit 8b5f257

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

code/scripting/api/libs/base.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,26 @@ ADE_FUNC(isEngineVersionAtLeast,
284284
return ade_set_args(L, "b", gameversion::check_at_least(version));
285285
}
286286

287+
ADE_FUNC(getCurrentLanguage,
288+
l_Base,
289+
nullptr,
290+
"Determines the language that is being used by the engine. This returns the full name of the language (e.g. \"English\").",
291+
"string",
292+
"The current game language") {
293+
return ade_set_args(L, "s", Lcl_languages[Lcl_current_lang].lang_name);
294+
}
295+
296+
ADE_FUNC(getCurrentLanguageExtension,
297+
l_Base,
298+
nullptr,
299+
"Determines the file extension of the language that is being used by the engine. "
300+
"This returns a short code for the current language that can be used for creating language specific file names (e.g. \"gr\" when the current language is German). "
301+
"This will return an empty string for the default language.",
302+
"string",
303+
"The current game language") {
304+
return ade_set_args(L, "s", Lcl_languages[Lcl_current_lang].lang_ext);
305+
}
306+
287307
//**********SUBLIBRARY: Base/Events
288308
ADE_LIB_DERIV(l_Base_Events, "GameEvents", NULL, "Freespace 2 game events", l_Base);
289309

0 commit comments

Comments
 (0)