diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2023-09-27 12:41:45 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2023-09-27 12:41:45 -0400 |
commit | 354585d6ad1e7cf5caaa6a35740966e238d14989 (patch) | |
tree | a0e53e1da3b6e518e05f9d2c9c36d3e0d42ea04d /indra/newview/skins/default/xui | |
parent | fa67efced89de1b7b432fca5a8d14f03b03ad88b (diff) |
DRTVWR-589: Add Lua-callable listen_events() function.
Add LuaListener, based on LLLeap. LuaListener has an int key so the second and
subsequent calls to listen_events() can find a previously-created one.
LuaListener listens on its LLEventPump and arranges to call the specified Lua
callback with any incoming event. It also instantiates an LLLeapListener.
listen_events() locates the main thread for its state: we only want to call
callbacks on the Lua chunk's main thread, not on a (possibly suspended)
coroutine. It finds or creates a LuaListener and stashes it in the main
thread's registry, along with the passed Lua callback function. Finally it
returns the names of the LuaListener's reply pump and the LLLeapListener's
command pump.
Add LuaState RAII class to manage the lifespan of each lua_State we create.
This encapsulates much of the boilerplate common to runScriptFile() and
runScriptLine(). In addition, LuaState's destructor checks for a LuaListener
key and, if found, destroys the referenced LuaListener.
LuaState's constructor requires a description to clarify log messages.
Move the checkLua() free function to a member of LuaState. This allows
capturing an error message to pass to the C++ completion callback, if any.
Use LuaState in runScriptFile() and runScriptLine(), synthesizing a suitable
description in each case.
Add print_debug() and print_info() logging calls, analogous to
print_warning(). Add luaL_where() prefix to every such message.
Add lua_pushstdstring(), like lua_tostdstring(): convenience for working with
the pointer and length used by lua_pushlstring() and lua_tolstring().
Clean up return values of lua_functions. A lua_CFunction returns the number of
return values it has pushed, so any 'void' lua_CFunction should pop its
arguments and return 0.
Diffstat (limited to 'indra/newview/skins/default/xui')
0 files changed, 0 insertions, 0 deletions