summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-09-11 22:01:24 +0300
committerGitHub <noreply@github.com>2026-09-11 22:01:24 +0300
commitaf221b2e583f34fa4bf9d1d59e91fd9fcb5887b7 (patch)
treea892b4779a80ea52c640ccfb237eddcccb056ed8 /indra/newview/llpreviewscript.cpp
parent20f4a772919afad60739a61a441c9e84251e31c0 (diff)
parent01f554d1a0a461f1ad3d7321566a04e7987038df (diff)
Merge from 26.4 into develop
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rw-r--r--indra/newview/llpreviewscript.cpp46
1 files changed, 38 insertions, 8 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 318467745c..cee1180fa7 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -85,6 +85,8 @@
#include <regex>
const std::string HELP_LSL_PORTAL_TOPIC = "LSL_Portal";
+const std::string HELP_LUA_PORTAL_URL = "https://wiki.secondlife.com/wiki/Lua_Alpha";
+const std::string HELP_LUA_LIBRARY_URL = "https://luau.org/library";
const std::string DEFAULT_SCRIPT_NAME = "New Script"; // *TODO:Translate?
const std::string DEFAULT_SCRIPT_DESC = "(No Description)"; // *TODO:Translate?
@@ -93,6 +95,36 @@ const std::string DEFAULT_SCRIPT_DESC = "(No Description)"; // *TODO:Translate?
const S32 MAX_HISTORY_COUNT = 10;
const F32 LIVE_HELP_REFRESH_TIME = 1.f;
+static bool is_luau_library_symbol(const std::string& symbol)
+{
+ return symbol.rfind("bit32.", 0) == 0
+ || symbol.rfind("buffer.", 0) == 0
+ || symbol.rfind("coroutine.", 0) == 0
+ || symbol.rfind("debug.", 0) == 0
+ || symbol.rfind("math.", 0) == 0
+ || symbol.rfind("os.", 0) == 0
+ || symbol.rfind("string.", 0) == 0
+ || symbol.rfind("table.", 0) == 0
+ || symbol.rfind("utf8.", 0) == 0;
+}
+
+static std::string build_script_help_url(bool luau_language, const std::string& help_string)
+{
+ if (!luau_language || help_string.rfind("ll.", 0) == 0)
+ {
+ LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
+ std::string page = help_string;
+ if (luau_language)
+ {
+ page.erase(2, 1); // Lua's ll.GetOwner maps to LSL's llGetOwner.
+ }
+ url_string.setArg("[LSL_STRING]", page.empty() ? HELP_LSL_PORTAL_TOPIC : page);
+ return url_string.getString();
+ }
+
+ return is_luau_library_symbol(help_string) ? HELP_LUA_LIBRARY_URL : HELP_LUA_PORTAL_URL;
+}
+
static bool have_script_upload_cap(LLUUID& object_id)
{
LLViewerObject* object = gObjectList.findObject(object_id);
@@ -867,13 +899,9 @@ void LLScriptEdCore::setHelpPage(const std::string& help_string)
LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo");
if (!history_combo) return;
- LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
-
- url_string.setArg("[LSL_STRING]", help_string.empty() ? HELP_LSL_PORTAL_TOPIC : help_string);
-
addHelpItemToHistory(help_string);
- web_browser->navigateTo(url_string);
+ web_browser->navigateTo(build_script_help_url(mEditor->getIsLuauLanguage(), help_string));
}
@@ -1008,6 +1036,10 @@ void LLScriptEdCore::onBtnDynamicHelp()
mLiveHelpHistorySize = 0;
}
+ const bool luau_language = mEditor->getIsLuauLanguage();
+ live_help_floater->setTitle(luau_language ? "LUA REFERENCE" : "LSL REFERENCE");
+ live_help_floater->setHelpTopic(luau_language ? "Lua_Alpha" : "lsl_reference");
+
bool visible = true;
bool take_focus = true;
live_help_floater->setVisible(visible);
@@ -1081,9 +1113,7 @@ void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata)
corep->addHelpItemToHistory(help_string);
LLMediaCtrl* web_browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
- LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
- url_string.setArg("[LSL_STRING]", help_string);
- web_browser->navigateTo(url_string);
+ web_browser->navigateTo(build_script_help_url(corep->mEditor->getIsLuauLanguage(), help_string));
}
}