From c42f38b8dfb3c1b65adca95a69099581917c69ec Mon Sep 17 00:00:00 2001 From: Donald Lee Date: Tue, 10 Aug 2021 07:27:58 +0800 Subject: [PATCH] doc: Update for consecutive frrscript_call Signed-off-by: Donald Lee --- doc/developer/scripting.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/developer/scripting.rst b/doc/developer/scripting.rst index d543ed3560..f0502697c5 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 ^^^^^^ -- 2.39.5