summaryrefslogtreecommitdiffstats
path: root/doc/developer/scripting.rst
diff options
context:
space:
mode:
authorDonald Lee <dlqs@gmx.com>2021-08-10 01:27:58 +0200
committerDonald Lee <dlqs@gmx.com>2021-08-10 01:35:32 +0200
commitc42f38b8dfb3c1b65adca95a69099581917c69ec (patch)
treed810268c5a4ca897142d868231a1a0c79ee93b11 /doc/developer/scripting.rst
parentlib: Enable consecutive frrscript_call (diff)
downloadfrr-c42f38b8dfb3c1b65adca95a69099581917c69ec.tar.xz
frr-c42f38b8dfb3c1b65adca95a69099581917c69ec.zip
doc: Update for consecutive frrscript_call
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, 14 insertions, 1 deletions
diff --git a/doc/developer/scripting.rst b/doc/developer/scripting.rst
index d543ed356..f0502697c 100644
--- a/doc/developer/scripting.rst
+++ b/doc/developer/scripting.rst
@@ -117,6 +117,7 @@ Load
The function to be called must first be loaded. Use ``frrscript_load()``
which takes a ``frrscript`` object, the name of the Lua function
and a callback function.
+The script file will be read to load and compile the function.
For example, to load the Lua function ``on_foo``
in ``/etc/frr/scripts/bingus.lua``:
@@ -138,7 +139,7 @@ should not be able to write the scripts directory anyway.
Call
^^^^
-After loading, Lua functions may be called.
+After loading, a Lua function can be called any number of times.
Input
"""""
@@ -231,6 +232,18 @@ In the example, ``d`` is a "new" value in C space,
so memory allocation might take place. Hence the caller is
responsible for memory deallocation.
+``frrscript_call()`` may be called multiple times without re-loading with
+``frrscript_load()``. Results are not preserved between consecutive calls.
+
+.. code-block:: c
+
+ frrscript_load(fs, "on_foo");
+
+ frrscript_call(fs, "on_foo");
+ frrscript_get_result(fs, "on_foo", ...);
+ frrscript_call(fs, "on_foo");
+ frrscript_get_result(fs, "on_foo", ...);
+
Delete
^^^^^^