core: core.globalSettingsDescriptions JS => C.

This commit is contained in:
2025-10-15 19:09:41 -04:00
parent 4bdc7ec616
commit 07605933dc
4 changed files with 107 additions and 9 deletions

View File

@@ -381,6 +381,31 @@ const char* tf_util_get_default_global_setting_string(const char* name)
return setting && setting->default_value.string_value ? setting->default_value.string_value : "";
}
bool tf_util_get_global_setting_by_index(int index, const char** out_name, const char** out_type, tf_setting_kind_t* out_kind, const char** out_description)
{
if (index >= 0 && index < tf_countof(k_settings))
{
if (out_name)
{
*out_name = k_settings[index].name;
}
if (out_type)
{
*out_type = k_settings[index].type;
}
if (out_kind)
{
*out_kind = k_settings[index].default_value.kind;
}
if (out_description)
{
*out_description = k_settings[index].description;
}
return true;
}
return false;
}
static JSValue _util_defaultGlobalSettings(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
{
JSValue settings = JS_NewObject(context);