From a870b767337d0f9c54953189f99a77ca06d634a4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 14 Sep 2023 21:21:03 +0100 Subject: DRTVWR-589 - lua support parameter to UI commands --- indra/newview/llluamanager.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'indra/newview/llluamanager.cpp') diff --git a/indra/newview/llluamanager.cpp b/indra/newview/llluamanager.cpp index 7045379964..1a1732aa5e 100644 --- a/indra/newview/llluamanager.cpp +++ b/indra/newview/llluamanager.cpp @@ -169,11 +169,24 @@ int lua_env_setting_event(lua_State *L) int lua_run_ui_command(lua_State *L) { - std::string func_name = lua_tostring(L,1); - LL_WARNS("LUA") << "running ui func " << func_name << LL_ENDL; + int top = lua_gettop(L); + std::string func_name; + if (top >= 1) + { + func_name = lua_tostring(L,1); + } + std::string parameter; + if (top >= 2) + { + parameter = lua_tostring(L,2); + } + LL_WARNS("LUA") << "running ui func " << func_name << " parameter " << parameter << LL_ENDL; LLSD event; event["function"] = func_name; - event["parameter"] = LLSD(); + if (!parameter.empty()) + { + event["parameter"] = parameter; + } sUIListener.call(event); return 1; -- cgit v1.2.3