summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llfloaterreglistener.cpp20
-rw-r--r--indra/newview/scripts/lua/require/UI.lua8
2 files changed, 23 insertions, 5 deletions
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index e17f9f4dd6..bd8d87086e 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -38,6 +38,7 @@
#include "llfloater.h"
#include "llbutton.h"
#include "llluafloater.h"
+#include "resultset.h"
LLFloaterRegListener::LLFloaterRegListener():
LLEventAPI("LLFloaterReg",
@@ -82,9 +83,9 @@ LLFloaterRegListener::LLFloaterRegListener():
&LLFloaterRegListener::getLuaFloaterEvents);
add("getFloaterNames",
- "Return the table of all registered floaters",
+ "Return result set key [\"floaters\"] for names of all registered floaters",
&LLFloaterRegListener::getFloaterNames,
- llsd::map("reply", LLSD()));
+ llsd::map("reply", LLSD::String()));
}
void LLFloaterRegListener::getBuildMap(const LLSD& event) const
@@ -126,10 +127,22 @@ void LLFloaterRegListener::instanceVisible(const LLSD& event) const
event);
}
+struct NameResultSet: public LL::ResultSet
+{
+ NameResultSet():
+ LL::ResultSet("floaters"),
+ mNames(LLFloaterReg::getFloaterNames())
+ {}
+ LLSD mNames;
+
+ int getLength() const override { return narrow(mNames.size()); }
+ LLSD getSingle(int index) const override { return mNames[index]; }
+};
void LLFloaterRegListener::getFloaterNames(const LLSD &event) const
{
- Response response(llsd::map("floaters", LLFloaterReg::getFloaterNames()), event);
+ auto nameresult = new NameResultSet;
+ sendReply(llsd::map("floaters", nameresult->getKeyLength()), event);
}
void LLFloaterRegListener::clickButton(const LLSD& event) const
@@ -178,4 +191,3 @@ void LLFloaterRegListener::getLuaFloaterEvents(const LLSD &event) const
{
Response response(llsd::map("events", LLLuaFloater::getEventsData()), event);
}
-
diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua
index bbcae3514a..aa64c0c7f9 100644
--- a/indra/newview/scripts/lua/require/UI.lua
+++ b/indra/newview/scripts/lua/require/UI.lua
@@ -2,6 +2,7 @@
local leap = require 'leap'
local mapargs = require 'mapargs'
+local result_view = require 'result_view'
local Timer = (require 'timers').Timer
local util = require 'util'
@@ -234,7 +235,12 @@ function UI.closeAllFloaters()
end
function UI.getFloaterNames()
- return leap.request("LLFloaterReg", {op = "getFloaterNames"}).floaters
+ local key_length = leap.request("LLFloaterReg", {op = "getFloaterNames"}).floaters
+ local view = result_view(key_length)
+ return LL.setdtor(
+ 'registered floater names',
+ view,
+ function(self) view:close() end)
end
return UI