]> git.puffer.fish Git - matthieu/frr.git/commitdiff
doc: Update for consecutive frrscript_call
authorDonald Lee <dlqs@gmx.com>
Mon, 9 Aug 2021 23:27:58 +0000 (07:27 +0800)
committerDonald Lee <dlqs@gmx.com>
Mon, 9 Aug 2021 23:35:32 +0000 (07:35 +0800)
Signed-off-by: Donald Lee <dlqs@gmx.com>
doc/developer/scripting.rst

index d543ed3560ae50111bca9dd5fd0ab7aaf6472f43..f0502697c5f67ff559c312c29ee183fe03507e0a 100644 (file)
@@ -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
 ^^^^^^