summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-07-03Merge branch 'release/luau-scripting' into lua-appearance-listener-tomapNat Goodspeed
2024-07-03Add llsd::toArray() and llsd::toMap() utility functions.Nat Goodspeed
These encapsulate looping over a C++ iterable (be it a sequence container or an associative container) and returning an LLSD array or map, respectively, derived from the C++ container. By default, each C++ container item is directly converted to LLSD. Also make LLSDParam<LLSD> slightly more efficient by using std::vector::emplace_back() instead of push_back(), which supports std::vector<std::unique_ptr>, so we need not use std::shared_ptr.
2024-07-02Merge branch 'release/luau-scripting' into lua-appearance-listenerNat Goodspeed
2024-07-02Merge pull request #1878 from secondlife/lua-pathsnat-goodspeed
Add LuaAutorunPath, LuaCommandPath and LuaRequirePath settings.
2024-07-02Merge branch 'release/luau-scripting' into lua-appearance-listenerNat Goodspeed
2024-07-02Eliminate c_str() calls from LLControlGroup::loadFromFile() calls.Nat Goodspeed
Passing std::string::c_str() to a (const std::string&) function parameter is worse than clutter, it's pointless overhead: it forces the compiler to construct a new std::string instance, instead of passing a const reference to the one you already have in hand.
2024-07-02Merge branch 'release/luau-scripting' into lua-pathsNat Goodspeed
2024-07-02Make require() implementation honor LuaRequirePath setting.Nat Goodspeed
Remove LL_TEST special case from require() code (to search in the viewer's source tree). Instead, make llluamanager_test.cpp append to LuaRequirePath to get the same effect.
2024-07-02Promote LuaRemover from llluamanager.cpp to lua_function.h.Nat Goodspeed
2024-07-01Merge pull request #1871 from secondlife/lua_emplace_betternat-goodspeed
Streamline and robustify lua_emplace<T>() object cleanup.
2024-07-01build fixMaxim Nikolenko
2024-07-01Move error strings to strings.xml; pass wearable type and is_worn flag for ↵Mnikolenko Productengine
outfit items
2024-06-28Add LuaAutorunPath, LuaCommandPath and LuaRequirePath settings.Nat Goodspeed
Remove AutorunLuaScriptFile and the LLLUAmanager::runScriptOnLogin() method that checked it. Instead, iterate over LuaAutorunPath directories at viewer startup, iterate over *.lua files in each and implicitly run those. LuaCommandPath and LuaRequirePath are not yet implemented.
2024-06-28Work around MSVC limitation: explicitly call fsyspath::string().Nat Goodspeed
2024-06-28Give our fsyspath an operator std::string() conversion method.Nat Goodspeed
This is redundant (but harmless) on a Posix system, but it fills a missing puzzle piece on Windows. The point of fsyspath is to be able to interchange freely between fsyspath and std::string. Existing fsyspath could be constructed and assigned from std::string, and we could explicitly call its string() method to get a std::string, but an implicit fsyspath-to-string conversion that worked on Posix would trip us up on Windows. Fix that.
2024-06-27Work around VS refusal to initialize a stringNat Goodspeed
2024-06-27Introduce TypeTag<T> template whose int value differs for each T.Nat Goodspeed
This replaces type_tag<T>(), which searched and possibly extended the type_tags unordered_map at runtime. If we called lua_emplace<T>() from different threads, that would require locking type_tags. In contrast, the compiler must instantiate a distinct TypeTag<T> for every distinct T passed to lua_emplace<T>(), so each gets a distinct value at static initialization time. No locking is required; no lookup; no allocations. Add a test to llluamanager_test.cpp to verify that each distinct T passed to lua_emplace<T>() gets its own TypeTag<T>::value, and that each gets its own destructor -- but that different lua_emplace<T>() calls with the same T share the same TypeTag<T>::value and the same destructor.
2024-06-27Make lua_emplace<T>() use Luau userdata tags with destructors.Nat Goodspeed
It turns out that Luau does not honor PUC-Rio Lua's __gc metafunction, so despite elaborate measures, the previous lua_emplace<T>() implementation would not have destroyed the contained C++ T object when the resulting userdata object was garbage-collected. Moreover, using LL.atexit() as the mechanism to destroy lua_emplace<T>() userdata objects (e.g. LuaListener) would have been slightly fragile because we also want to use LL.atexit() to make the final fiber.run() call, when appropriate. Introducing an order dependency between fiber.run() and the LuaListener destructor would not be robust. Both of those problems are addressed by leveraging one of Luau's extensions over PUC-Rio Lua. A Luau userdata object can have an int tag; and a tag can have an associated C++ destructor function. When any userdata object bearing that tag is garbage-collected, Luau will call that destructor; and Luau's lua_close() function destroys all userdata objects. The resulting lua_emplace<T>() and lua_toclass<T>() code is far simpler. It only remains to generate a distinct int tag value for each different C++ type passed to the lua_emplace<T>() template. unordered_map<std::type_index, int> addresses that need.
2024-06-27Make test.cpp test driver recognize LOGTEST_testname.Nat Goodspeed
Setting LOGTEST=DEBUG, when many unit/integration tests must be rebuilt and run, can result in lots of unnecessary output. When we only want DEBUG log output from a specific test program, make test.cpp recognize an environment variable LOGTEST_testname, where 'testname' might be the full basename of the executable, or part of INTEGRATION_TEST_testname or PROJECT_foo_TEST_testname. When test.cpp notices a non-empty variable by that name, it behaves as if LOGTEST were set to that value.
2024-06-25Add wear/detach actions to Appearance listener; update example scriptMnikolenko Productengine
2024-06-24Merge branch 'release/luau-scripting' into lua-appearance-listenerMnikolenko Productengine
2024-06-21Merge pull request #1725 from secondlife/lua-loginnat-goodspeed
UI-related Lua API work
2024-06-21Exercise the simple popup.lua APIsNat Goodspeed
2024-06-21Remove pre-Floater.lua versions of the floater test scripts.Nat Goodspeed
2024-06-21login.lua works now, update test_login.lua accordingly.Nat Goodspeed
2024-06-21Introduce require/logout.lua and test_logout.lua.Nat Goodspeed
Add "userQuit" operation to LLAppViewerListener to engage LLAppViewer::userQuit(), which pops up "Are you sure?" prompt unless suppressed.
2024-06-21Multiple LL.atexit(function) calls run functions in reverse order.Nat Goodspeed
2024-06-21Add Appearance listenerMnikolenko Productengine
2024-06-21Use util.classctor(LLChatListener).Nat Goodspeed
2024-06-21Move newer Lua modules to scripts/lua/require subdirectory.Nat Goodspeed
2024-06-21Merge branch 'release/luau-scripting' into lua-loginNat Goodspeed
2024-06-21Merge pull request #1767 from secondlife/lua-chat-listenernat-goodspeed
Add nearby chat listener
2024-06-20Merge branch 'release/luau-scripting' into lua-chat-listenerNat Goodspeed
2024-06-20Use new popup.lua, which supersedes LLNotification.lua.Nat Goodspeed
Use ClassName(ctor args) for classes using util.classctor().
2024-06-20Merge branch 'release/luau-scripting' into lua-loginNat Goodspeed
2024-06-20Merge pull request #1297 from secondlife/lua-speedometer-demonat-goodspeed
Add demo script with idle and notification interactions
2024-06-20Revert LLLuaFloater "idle" events in favor of Lua timers.Timer().nat-goodspeed
2024-06-20Merge branch 'release/luau-scripting' into lua-speedometer-demoNat Goodspeed
2024-06-20Give popup() the ability to not wait; add popup:tip(message).Nat Goodspeed
popup:tip() engages 'SystemMessageTip'.
2024-06-20Use LLLeapListener to listen to LLNearbyChat pumpMnikolenko Productengine
2024-06-19Move popup.lua to require subdir with the rest of the modules.Nat Goodspeed
2024-06-19Improve LL.help() function.Nat Goodspeed
The help string for each lua_function() must restate the function name and its arguments. The help string is all that's shown; unless it restates the function name, LL.help() output lists terse explanations for functions whose names are not shown. Make help() prepend "LL." to help output, because these functions must be accessed via the "builtin" LL table instead of directly populating the global Lua namespace. Similarly, before string name lookup, remove "LL." prefix if specified.
2024-06-19Try harder to keep Luau's lua_getinfo() from crashing.Nat Goodspeed
2024-06-18Merge branch 'lua-login' of github.com:secondlife/viewer into lua-loginNat Goodspeed
2024-06-18Initialize lua_Debug lluau::source_path() passes to lua_getinfo().Nat Goodspeed
On Mac it doesn't seem to matter, but on Windows, leaving it uninitialized can produce garbage results and even crash the coroutine. This seems strange, since we've been assuming lua_getinfo() treats its lua_Debug* as output-only.
2024-06-18Use LL_DEBUGS("Lua") for LuaLog.Nat Goodspeed
We might decide to leave some of them in place.
2024-06-18Improve diagnostic output from running 'require' module.Nat Goodspeed
2024-06-18Remove special-case ~LuaState() code to call fiber.run().Nat Goodspeed
Instead, make fiber.lua call LL.atexit(fiber.run) to schedule that final run() call at ~LuaState() time using the generic mechanism. Append an explicit fiber.run() call to a specific test in llluamanager_test.cpp because the test code wants to interact with multiple Lua fibers *before* we destroy the LuaState.
2024-06-18Make ~LuaState() walk Registry.atexit table backwardsNat Goodspeed
so cleanup happens in reverse order, as is conventional. Streamline LL.atexit() function: luaL_newmetatable() performs all the find-or-create named Registry table logic.
2024-06-18lua_emplace<T>() should permit GC despite LL.atexit() safety net.Nat Goodspeed
lua_emplace<T>() was passing LL.atexit() a closure binding the new userdata with a cleanup function. The trouble with that was that a strong reference to the new userdata would prevent it ever being garbage collected, even if that was the only remaining reference. Instead, create a new weak table referencing the userdata, and bind that into the cleanup function's closure. Then if the only remaining reference to the userdata is from the weak table, the userdata can be collected. Make lua_emplace_call_gc<T>() check the bound weak table in case the userdata has in fact been collected. Also, in lua_toclass<T>(), use luaL_checkudata() to synopsize comparing the putative userdata's metatable against the one synthesized by lua_emplace<T>(). This saves several explicit steps.