summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-09-26 17:20:47 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-09-26 17:20:47 +0300
commit80066449b9cbee018dd1c874c02579b1cbd3d348 (patch)
tree08806b5cca91656c9296469447420099f53fbe23 /indra/newview/scripts/lua
parented7603bfe63ce5e8c1ff1101270e0406de01dc92 (diff)
update LLListener and related scripts
Diffstat (limited to 'indra/newview/scripts/lua')
-rw-r--r--indra/newview/scripts/lua/require/LLListener.lua18
-rw-r--r--indra/newview/scripts/lua/test_LLChatListener.lua4
-rw-r--r--indra/newview/scripts/lua/test_autopilot.lua4
3 files changed, 13 insertions, 13 deletions
diff --git a/indra/newview/scripts/lua/require/LLListener.lua b/indra/newview/scripts/lua/require/LLListener.lua
index e3bfb6b358..b05f966097 100644
--- a/indra/newview/scripts/lua/require/LLListener.lua
+++ b/indra/newview/scripts/lua/require/LLListener.lua
@@ -6,12 +6,12 @@ local util = require 'util'
local LLListener = {}
local waitfor = {}
local listener_name = {}
-local pump = {}
-function LLListener:new()
+function LLListener:new(pump_name)
local obj = setmetatable({}, self)
self.__index = self
- obj.name = 'Listener'
+ obj.name = 'Listener:' .. pump_name
+ obj._pump = pump_name
return obj
end
@@ -23,11 +23,11 @@ function LLListener:handleMessages(event_data)
return true
end
-function LLListener:start(pump_name)
- pump = pump_name
+function LLListener:start()
+ _pump = self._pump
waitfor = leap.WaitFor(-1, self.name)
- function waitfor:filter(pump_, data)
- if pump == pump_ then
+ function waitfor:filter(pump, data)
+ if _pump == pump then
return data
end
end
@@ -39,11 +39,11 @@ function LLListener:start(pump_name)
end
end)
- listener_name = leap.request(leap.cmdpump(), {op='listen', source=pump, listener="LLListener", tweak=true}).listener
+ listener_name = leap.request(leap.cmdpump(), {op='listen', source=_pump, listener="LLListener", tweak=true}).listener
end
function LLListener:stop()
- leap.send(leap.cmdpump(), {op='stoplistening', source=pump, listener=listener_name})
+ leap.send(leap.cmdpump(), {op='stoplistening', source=self._pump, listener=listener_name})
waitfor:close()
end
diff --git a/indra/newview/scripts/lua/test_LLChatListener.lua b/indra/newview/scripts/lua/test_LLChatListener.lua
index 1df2880f3d..0f269b54e6 100644
--- a/indra/newview/scripts/lua/test_LLChatListener.lua
+++ b/indra/newview/scripts/lua/test_LLChatListener.lua
@@ -22,7 +22,7 @@ function openOrEcho(message)
end
end
-local listener = LLListener()
+local listener = LLListener(LLChat.nearbyChatPump)
function listener:handleMessages(event_data)
if string.find(event_data.message, '[LUA]') then
@@ -36,4 +36,4 @@ function listener:handleMessages(event_data)
return true
end
-listener:start(LLChat.nearbyChatPump)
+listener:start()
diff --git a/indra/newview/scripts/lua/test_autopilot.lua b/indra/newview/scripts/lua/test_autopilot.lua
index 0560477d38..09c85c140a 100644
--- a/indra/newview/scripts/lua/test_autopilot.lua
+++ b/indra/newview/scripts/lua/test_autopilot.lua
@@ -7,7 +7,7 @@ pos[2]+=5 -- delta y
LLAgent.requestStand()
LLAgent.startAutoPilot{target_global=pos,allow_flying=false,stop_distance=1}
-local listener = LLListener()
+local listener = LLListener(LLAgent.autoPilotPump)
function listener:handleMessages(event_data)
if event_data.success then
@@ -19,4 +19,4 @@ function listener:handleMessages(event_data)
return false
end
-listener:start(LLAgent.autoPilotPump)
+listener:start()