summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <118752495+marchcat@users.noreply.github.com>2026-04-16 22:09:14 +0300
committerGitHub <noreply@github.com>2026-04-16 22:09:14 +0300
commit65b9b2cb5cde2c344da51a7b677c1b99591d8ad3 (patch)
tree569f248515a4da0c5643420272ccc5074cb60e45 /indra/newview/llpreviewscript.cpp
parentf209affdfdf271098843ba400d7a75b00f827233 (diff)
parent4708693c577eb4ebbae914937fba2ebdc2c31a33 (diff)
Merge pull request #5659 from secondlife/marchcat/slua-26.1.1
Update SLua PV to 26.1.1
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);
}