summaryrefslogtreecommitdiff
path: root/doc/developer/scripting.rst
diff options
context:
space:
mode:
authorDonald Lee <dlqs@gmx.com>2021-06-28 05:38:23 +0800
committerDonald Lee <dlqs@gmx.com>2021-06-28 05:38:23 +0800
commita9a8bb1c9e53dcef15d406ad6da0c3c1aeed236e (patch)
tree05e9d7787b96ccbd1ebb3d572e97671690142535 /doc/developer/scripting.rst
parent19eee398d4f25af835837894b276e2a1796a98f5 (diff)
doc: fix formatting
Signed-off-by: Donald Lee <dlqs@gmx.com>
Diffstat (limited to 'doc/developer/scripting.rst')
-rw-r--r--doc/developer/scripting.rst15
1 files changed, 10 insertions, 5 deletions
diff --git a/doc/developer/scripting.rst b/doc/developer/scripting.rst
index dae16f9ac8..dc86948186 100644
--- a/doc/developer/scripting.rst
+++ b/doc/developer/scripting.rst
@@ -246,6 +246,7 @@ Again, for ``struct prefix``:
}
.. warning::
+
``lua_decode_prefix`` functions should leave the Lua stack completely empty
when they return.
For decoders that unmarshall fields from tables, remember to pop the table
@@ -287,18 +288,22 @@ structures.
To register a new type with its corresponding encoding and decoding functions,
add the mapping in the following macros in ``frrscript.h``:
-.. code-block:: c
+.. code-block:: diff
#define ENCODE_ARGS_WITH_STATE(L, value) \
_Generic((value), \
...
- struct prefix * : lua_pushprefix, \
+ -struct peer * : lua_pushpeer \
+ +struct peer * : lua_pushpeer, \
+ +struct prefix * : lua_pushprefix \
)(L, value)
#define DECODE_ARGS_WITH_STATE(L, value) \
_Generic((value), \
...
- struct prefix * : lua_decode_prefix, \
+ -struct peer * : lua_decode_peer \
+ +struct peer * : lua_decode_peer, \
+ +struct prefix * : lua_decode_prefix \
)(L, -1, value)
@@ -315,12 +320,12 @@ But we still need a decoder for the type of value so that the compiler will be
satisfied.
For that, use ``lua_decode_noop``:
-.. code-block:: c
+.. code-block:: diff
#define DECODE_ARGS_WITH_STATE(L, value) \
_Generic((value), \
...
- const struct prefix * : lua_decode_noop, \
+ +const struct prefix * : lua_decode_noop \
)(L, -1, value)