summaryrefslogtreecommitdiffstatshomepage
path: root/docs/source
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-03-07 01:39:42 +1100
committer Vas Crabb <vas@vastheman.com>2023-03-07 01:39:42 +1100
commitb5475eb38b8b79a13a0a9e8a6cb68755b84f0c7b (patch)
tree005b70ffe81cab56d55873ac6ee68725e5ba9d36 /docs/source
parent2102c32d2f3f94e69e3baf60294be3c04ca8b09f (diff)
Various updates, mostly around Lua:
Compile Lua as C++. When Lua is compiled as C, it uses setjmp/longjmp for error handling, resulting in failure to unwind intermediate stack frames. Trying to ensure no objects with non-trivial destructors are in scope when raising a Lua error is error-prone. In particular, converting an exception to a Lua error becomes convoluted, and raising a Lua error from a constructor is effectively impossible. Updated Lua to 5.4.4 - this includes a brand-new garbage collector implementation with better performance. The main thing removed is the deprecated bitlib. Updated sol2 to version 3.3.0 - this adds support for Lua 5.4 and fixes a number of issues, including not correctly handling errors when Lua is built as C++. Updated LuaFileSystem to version 1.8.0 - this adds support for symbolic links on Windows, as well as Lua 5.4 compatibility. Updated LuaSQLite3 to version 0.9.5 - this fixes issues in multi-threaded environments, as well as Lua 5.4 compatibility. Fixed double-free after attempting to construct a debugger expression from Lua with an invalid string, and exposed expression error to Lua in a better way. Added warning level print function to Lua. Fixed saving cheats with shift operators in expressions, although this code isn't actually used as there's no cheat editor.
Diffstat (limited to 'docs/source')
-rw-r--r--docs/source/techspecs/luareference.rst35
1 files changed, 28 insertions, 7 deletions
diff --git a/docs/source/techspecs/luareference.rst b/docs/source/techspecs/luareference.rst
index 8ca4e984517..28ee0c08c75 100644
--- a/docs/source/techspecs/luareference.rst
+++ b/docs/source/techspecs/luareference.rst
@@ -3953,8 +3953,9 @@ emu.parsed_expression(symbols, string, [default_base])
Creates an expression by parsing the supplied string, looking up symbols in
the supplied :ref:`symbol table <luareference-debug-symtable>`. If the
default base for interpreting integer literals is not supplied, 16 is used
- (hexadecimal). Raises an error if the string contains syntax errors or uses
- undefined symbols.
+ (hexadecimal). Raises an :ref:`expression error
+ <luareference-debug-expressionerror>` if the string contains syntax errors
+ or uses undefined symbols.
Methods
^^^^^^^
@@ -3964,13 +3965,14 @@ expression:set_default_base(base)
positive integer.
expression:parse(string)
Parse a debugger expression string. Replaces the current contents of the
- expression if it is not empty. Raises an error if the string contains
- syntax errors or uses undefined symbols. The previous content of the
- expression is not preserved when attempting to parse an invalid expression
- string.
+ expression if it is not empty. Raises an :ref:`expression error
+ <luareference-debug-expressionerror>` if the string contains syntax errors
+ or uses undefined symbols. The previous content of the expression is not
+ preserved when attempting to parse an invalid expression string.
expression:execute()
Evaluates the expression, returning an unsigned integer result. Raises an
- error if the expression cannot be evaluated (e.g. calling a function with an
+ :ref:`expression error <luareference-debug-expressionerror>` if the
+ expression cannot be evaluated (e.g. attempting to call a function with an
invalid number of arguments).
Properties
@@ -4224,3 +4226,22 @@ watchpoint.condition (read-only)
watchpoint.action (read-only)
An action the debugger will run when the watchpoint is hit and the condition
evaluates to a non-zero value. An empty string if no action was specified.
+
+.. _luareference-debug-expressionerror:
+
+Expression error
+~~~~~~~~~~~~~~~~
+
+Wraps MAME’s ``expression_error`` class, describing an error occurring while
+parsing or executing a debugger expression. Raised on errors when using
+:ref:`parsed expressions <luareference-debug-expression>`. Can be converted to
+a string to provide a description of the error.
+
+Properties
+^^^^^^^^^^
+
+err.code (read-only)
+ An implementation-dependent number representing the category of error.
+ Should not be displayed to the user.
+err.offset (read-only)
+ The offset within the expression string where the error was encountered.