Age | Commit message (Collapse) | Author |
|
|
|
That means that as you use the floater, variables that you assign and
functions that you define are available to subsequent Lua chunks.
|
|
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.
|
|
|
|
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.
|
|
|
|
|