diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-09-20 15:13:43 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-09-20 15:13:43 -0400 |
commit | 6d29beb91b019e1995cdb7c4aaf7a043de4bf053 (patch) | |
tree | c4772496fd833a934d1b7e93028b107b0e36ed8f /indra/llcommon/CMakeLists.txt | |
parent | 50513bab2d6b1823f983c145553b8a6af44c2f28 (diff) |
Add ability to pass command-line arguments to a Lua script.
Introduce `ScriptCommand` class that parses a command line into a script name
and optional args, using bash-like quoting and escaping. `ScriptCommand`
searches for a file with that script name on a passed list of directories; the
directories may be specified relative to a particular base directory.
`ScriptCommand` supports the special case of a script name containing unescaped
spaces. It guarantees that either the returned script file exists, or its
`error()` string is non-empty.
Replace `LLLeap::create()` logic, from which `ScriptCommand` was partly
derived, with a `ScriptCommand` instance.
Make `LLLUAmanager::runScriptFile()` use a `ScriptCommand` instance to parse
the passed command line.
Subsume `LLAppViewer::init()` script-path-searching logic for `--luafile`
into `ScriptCommand`. In fact that lambda now simply calls
`LLLUAmanager::runScriptFile()`.
Make `lluau::dostring()` accept an optional vector of script argument strings.
Following PUC-Rio Lua convention, pass these arguments into a Lua script as
the predefined global `arg`, and also as the script's `...` argument.
`LuaState::expr()` also accepts and passes through script argument strings.
Change the log tag for the Lua script interruption message: if we want it, we
can still enable it, but we don't necessarily want it along with all other
"Lua" DEBUG messages.
Remove `LuaState::script_finished_fn`, which isn't used any more. Also remove
the corresponding `LLLUAmanager::script_finished_fn`. This allows us to
simplify `~LuaState()` slightly, as well as the parameter signatures for
`LLLUAmanager::runScriptFile()` and `runScriptLine()`.
Diffstat (limited to 'indra/llcommon/CMakeLists.txt')
-rw-r--r-- | indra/llcommon/CMakeLists.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index f47136f781..9b99d86434 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -108,6 +108,7 @@ set(llcommon_SOURCE_FILES lua_function.cpp lualistener.cpp resultset.cpp + scriptcommand.cpp threadpool.cpp throttle.cpp u64.cpp @@ -257,6 +258,7 @@ set(llcommon_HEADER_FILES lua_function.h lualistener.h resultset.h + scriptcommand.h stdtypes.h stringize.h tempset.h |