summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2026-04-10 17:43:15 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2026-04-10 17:55:18 +0300
commit6c85123a3a38a28d06089901c0b5c08e4782de58 (patch)
treee5dea08711ddc1faf4821bae000bd58c9ac6f498 /indra/newview/llpreviewscript.cpp
parentf5908eddc683dd705d334c88377139e39bbfb54f (diff)
parent5c500ccf407f0b5a0b253b98dd4bd3f33f643aba (diff)
Merge remote-tracking branch 'origin/main' into marchcat/slua-26.1.1
# Conflicts: # .github/workflows/build.yaml # autobuild.xml # indra/cmake/Python.cmake # indra/newview/CMakeLists.txt # indra/newview/llappviewer.cpp # indra/newview/llappviewerwin32.cpp # indra/newview/llpanellogin.cpp
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rw-r--r--indra/newview/llpreviewscript.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 31909116c7..a9e3afbc58 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -2122,6 +2122,11 @@ void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType t
if (compile_target.empty())
{
+ if (!is_lua)
+ {
+ // No language info from inventory metadata; fall back to content analysis.
+ is_lua = is_lua_script(std::string(&buffer[0], file_length));
+ }
compile_target = is_lua ? "luau" : "mono";
}
@@ -2432,6 +2437,29 @@ void LLLiveLSLEditor::loadScriptText(const LLUUID &uuid, LLAssetType::EType type
script_name = inv_item->getName();
}
mScriptEd->setScriptName(script_name);
+
+ // Detect language from inventory metadata, with content-based fallback.
+ bool is_lua = false;
+ std::string compile_target;
+ if (inv_item)
+ {
+ U8 subtype = inv_item->getInventorySubType();
+ std::string runtime = inv_item->getRuntime();
+ is_lua = (subtype == SST_LUA);
+ if (!is_lua && (runtime == "luau"))
+ compile_target = "lsl-luau";
+ else
+ compile_target = runtime;
+ }
+ if (compile_target.empty())
+ {
+ if (!is_lua)
+ is_lua = is_lua_script(std::string(&buffer[0], file_length));
+ compile_target = is_lua ? "luau" : "mono";
+ }
+ mScriptEd->mCompileTarget->setValue(compile_target);
+ mScriptEd->mEditor->setLuauLanguage(is_lua);
+ mScriptEd->processKeywords(is_lua);
}