summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterluadebug.h
AgeCommit message (Collapse)Author
2024-09-04Swat a few more buzzing BOOLs.Nat Goodspeed
2024-08-28Ditch trailing spaces.Nat Goodspeed
2024-07-10Remove ability to reuse a LuaState between LLLUAmanager functions.Nat Goodspeed
Remove LLLUAmanager::mumbleScriptLine() LuaState& parameters. Make startScriptLine(), waitScriptLine() and runScriptLine() exactly parallel to startScriptFile(), waitScriptFile() and runScriptFile(). That means that runScriptLine()'s C++ coroutine instantiates and destroys its own LuaState, which means that LL.atexit() functions will run on the Lua-specific C++ coroutine rather than (say) the viewer's main coroutine. Introduce LLLUAmanager::script_result typedef for std::pair<int, LLSD> and use in method returns. Remove LuaState::initLuaState(); move its logic back into the constructor. Remove initLuaState() calls in the expr() error cases: they're moot now that we won't get subsequent expr() calls on the same LuaState instance. Remove LLFloaterLUADebug "Use clean lua_State" checkbox and the cleanLuaState() method. Remove mState member. Remove explicit LuaState declarations from LLLUAmanager tests. Adapt one test for implicit LuaState: it was directly calling LuaState::obtainListener() to discover the LuaListener's reply-pump name. But since that test also captures two leap.request() calls from the Lua script, it can just look at the "reply" key in either of those requests.
2024-06-12Provide LUA Debug Console feedback for user typing LUA string.Nat Goodspeed
When the user explicitly types 'return expression[, expression]...' we convert the result of the expressions to LLSD and format them into the LUA Debug Console, which serves as a useful acknowledgment. But until now, if the user neither invoked print() nor ran a 'return' statement, the LUA Debug Console output remained empty. This could be a little disconcerting: you click Execute, or press Enter, and apparently nothing happens. You must either monitor viewer log output, or simply trust that the Lua snippet ran. When there are no 'return' results, at least emit 'ok'. But when the user is entering a series of no-output commands, vary the 'ok' output by appending a counter: 'ok 1', 'ok 2' etc.
2024-06-12Defend LLFloaterLUADebug against recursive calls to handlers.Nat Goodspeed
The special case of a Lua snippet that indirectly invokes the "LLNotifications" listener can result in a recursive call to LLFloaterLUADebug's handler methods. Defend against that case.
2024-02-21Add the option to use clean lua_State in "Lua debug" floaterMnikolenko Productengine
2024-02-09Make LLFloaterLUADebug store a persistent LuaState.Nat Goodspeed
That means that as you use the floater, variables that you assign and functions that you define are available to subsequent Lua chunks.
2024-02-09When LLFloaterLUADebug script returns a value, display the value.Nat Goodspeed
The chunk: return 1, 2, {} differs in two ways from: print(1, 2, {}) First, print() engages the Lua tostring() builtin, so it displays values as Lua sees them. (For a table, tostring() displays "table: hex", which isn't so wonderful.) But LLFloaterLUADebug serializes the LLSD converted from the Lua return values. Second, we've overridden print() to engage a function that writes to the viewer log as well as displaying to LLFloaterLUADebug. (As we go forward, most Lua scripts won't be run manually by LLFloaterLUADebug.) The values returned by a Lua chunk aren't implicitly logged. Each C++ caller wanting to evaluate a Lua expression can choose whether to log the results.
2024-01-26DRTVWR-589: update to start using Luau libsMnikolenko Productengine
2023-09-30DRTVWR-589: Emulate print() better, show output on Lua floater.Nat Goodspeed
Break out a lua_print_msg() function common to print_debug(), print_info() and print_warning(). Instead of accepting a single argument, lua_print_msg() accepts arbitrary arguments, passing each to the Lua tostring() function and concatenating the results. In addition to returning the combined string to its caller for level-appropriate logging, it also posts the message to a "lua output" LLEventPump for any interested party. Make LLFloaterLUADebug listen on "lua output" when the floater is constructed, storing the connection in an LLTempBoundListener to stop listening when the floater is destroyed. Append each message to the floater's output panel with a line break. Make LLTextEditor::addLineBreakChar() public. insertText("\n") only appends a little rectangle glyph. Enlarge the text capacity of the floater's output panel to be able to report whatever messages a Lua script wants to print. Add diagnostic logging for posting events from Lua, and receiving events to forward to Lua. Since lua_pop() is a macro implemented on lua_settop(), replace the awkward construct lua_pop(L, lua_gettop(L)) with lua_settop(L, 0). Use lambdas instead of std::bind() to connect LuaListener and LLLeapListener.
2023-09-15DRTVWR-589 - lua file browser added run button to allow re-running same scriptBrad Payne (Vir Linden)
2023-09-05Initial prototype of embedded LUAMnikolenko Productengine