diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-11-25 04:53:48 +0200 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-11-25 04:53:48 +0200 |
| commit | 44143786ad54d7ebfee6442a92f1c49ff570e94a (patch) | |
| tree | 84b608c835ae276dbd037e2fe1376ffb5631b742 /indra/newview/llviewerinventory.cpp | |
| parent | 8fb3e99ce01316bcd2e54e3770773a4fdc6f46ec (diff) | |
| parent | 2c3ce8fb8ce3967d957e13d48627b45dd32f0e00 (diff) | |
Merge branch 'project/lua_editor' into marchcat/slua-linux
Diffstat (limited to 'indra/newview/llviewerinventory.cpp')
| -rw-r--r-- | indra/newview/llviewerinventory.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 0954e4adcd..0e63c69916 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1016,6 +1016,19 @@ void set_default_permissions(LLViewerInventoryItem* item, std::string perm_type) } } +// See below comment in `create_script_cb()` about this hack :( +static const std::string DEFAULT_SLUA_SCRIPT = R"( +function LLEvents.touch_start(detected) + ll.Say(0, "Touched.") +end + +local function main() + print("Hello, Avatar!") +end + +main() +)"; + void create_script_cb(const LLUUID& inv_item) { if (!inv_item.isNull()) @@ -1039,26 +1052,13 @@ void create_script_cb(const LLUUID& inv_item) region->getSimulatorFeatures(simulatorFeatures); if (simulatorFeatures["LuaScriptsEnabled"].asBoolean()) { - - const std::string hello_lua_script = - "function state_entry()\n" - " ll.Say(0, \"Hello, Avatar!\")\n" - "end\n" - "\n" - "function touch_start(total_number)\n" - " ll.Say(0, \"Touched.\")\n" - "end\n" - "\n" - "-- Simulate the state_entry event\n" - "state_entry()\n"; - std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent"); if (!url.empty()) { LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLScriptAssetUpload>( item->getUUID(), "luau", - hello_lua_script, + DEFAULT_SLUA_SCRIPT, nullptr, nullptr)); |
