summaryrefslogtreecommitdiff
path: root/indra/newview/scripts
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-03-27 17:24:26 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-03-27 17:24:26 -0400
commit29eee8bd6e92b94a52e8489b98cb81a396d230ed (patch)
tree22daf3061082bb5397462be58d41a1838eab0dcd /indra/newview/scripts
parentaf38e606865c2ed49a13bd6bd91d9604997798c8 (diff)
parent55c32761a0be05c7d4b4e17765e2d341efb0ebe6 (diff)
Merge 'release/luau-scripting' of secondlife/viewer into lua-startup
Diffstat (limited to 'indra/newview/scripts')
-rw-r--r--indra/newview/scripts/lua/luafloater_demo.xml13
-rw-r--r--indra/newview/scripts/lua/test_luafloater_demo.lua24
-rw-r--r--indra/newview/scripts/lua/test_luafloater_gesture_list.lua21
3 files changed, 23 insertions, 35 deletions
diff --git a/indra/newview/scripts/lua/luafloater_demo.xml b/indra/newview/scripts/lua/luafloater_demo.xml
index 069f229128..b2273d7718 100644
--- a/indra/newview/scripts/lua/luafloater_demo.xml
+++ b/indra/newview/scripts/lua/luafloater_demo.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
legacy_header_height="18"
- height="150"
+ height="300"
layout="topleft"
name="lua_demo"
title="LUA"
@@ -79,4 +79,15 @@
text_color="white"
left_delta="15"
name="time_lbl"/>
+ <text_editor
+ follows="top|left"
+ font="SansSerif"
+ height="140"
+ left="5"
+ enabled="false"
+ name="events_editor"
+ top_pad="15"
+ word_wrap="true"
+ max_length="65536"
+ width="310"/>
</floater>
diff --git a/indra/newview/scripts/lua/test_luafloater_demo.lua b/indra/newview/scripts/lua/test_luafloater_demo.lua
index 4e071e4abe..c375a2abc7 100644
--- a/indra/newview/scripts/lua/test_luafloater_demo.lua
+++ b/indra/newview/scripts/lua/test_luafloater_demo.lua
@@ -1,21 +1,15 @@
XML_FILE_PATH = "luafloater_demo.xml"
leap = require 'leap'
-coro = require 'coro'
-util = require 'util'
+fiber = require 'fiber'
--event pump for sending actions to the floater
COMMAND_PUMP_NAME = ""
--table of floater UI events
-event_list={}
-coro.launch(function ()
- event_list = leap.request("LLFloaterReg", {op="getFloaterEvents"})["events"]
- leap.done()
-end)
-leap.process()
+event_list=leap.request("LLFloaterReg", {op="getFloaterEvents"}).events
local function _event(event_name)
- if not util.contains(event_list, event_name) then
+ if not table.find(event_list, event_name) then
LL.print_warning("Incorrect event name: " .. event_name)
end
return event_name
@@ -31,6 +25,7 @@ function getCurrentTime()
end
function handleEvents(event_data)
+ post({action="add_text", ctrl_name="events_editor", value = event_data})
if event_data.event == _event("commit") then
if event_data.ctrl_name == "disable_ctrl" then
post({action="set_enabled", ctrl_name="open_btn", value = (1 - event_data.value)})
@@ -53,12 +48,7 @@ end
local key = {xml_path = XML_FILE_PATH, op = "showLuaFloater"}
--sign for additional events for defined control {<control_name>= {action1, action2, ...}}
key.extra_events={show_time_lbl = {_event("right_mouse_down"), _event("double_click")}}
-coro.launch(function ()
- --script received event pump name, after floater was built
- COMMAND_PUMP_NAME = leap.request("LLFloaterReg", key)["command_name"]
- leap.done()
-end)
-leap.process()
+COMMAND_PUMP_NAME = leap.request("LLFloaterReg", key).command_name
catch_events = leap.WaitFor:new(-1, "all_events")
function catch_events:filter(pump, data)
@@ -73,6 +63,4 @@ function process_events(waitfor)
end
end
-coro.launch(process_events, catch_events)
-leap.process()
-LL.print_warning("End of the script")
+fiber.launch("catch_events", process_events, catch_events)
diff --git a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua b/indra/newview/scripts/lua/test_luafloater_gesture_list.lua
index 9c718c353b..6d4a8e0cad 100644
--- a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua
+++ b/indra/newview/scripts/lua/test_luafloater_gesture_list.lua
@@ -1,22 +1,16 @@
XML_FILE_PATH = "luafloater_gesture_list.xml"
leap = require 'leap'
-coro = require 'coro'
-util = require 'util'
+fiber = require 'fiber'
LLGesture = require 'LLGesture'
--event pump for sending actions to the floater
COMMAND_PUMP_NAME = ""
--table of floater UI events
-event_list={}
-coro.launch(function ()
- event_list = leap.request("LLFloaterReg", {op="getFloaterEvents"})["events"]
- leap.done()
-end)
-leap.process()
+event_list=leap.request("LLFloaterReg", {op="getFloaterEvents"}).events
local function _event(event_name)
- if not util.contains(event_list, event_name) then
+ if not table.find(event_list, event_name) then
LL.print_warning("Incorrect event name: " .. event_name)
end
return event_name
@@ -51,11 +45,7 @@ end
local key = {xml_path = XML_FILE_PATH, op = "showLuaFloater"}
--receive additional events for defined control {<control_name>= {action1, action2, ...}}
key.extra_events={gesture_list = {_event("double_click")}}
-coro.launch(function ()
- handleEvents(leap.request("LLFloaterReg", key))
- leap.done()
-end)
-leap.process()
+handleEvents(leap.request("LLFloaterReg", key))
catch_events = leap.WaitFor:new(-1, "all_events")
function catch_events:filter(pump, data)
@@ -70,5 +60,4 @@ function process_events(waitfor)
end
end
-coro.launch(process_events, catch_events)
-leap.process()
+fiber.launch("catch_events", process_events, catch_events)