$darkmode
Elektra 0.11.0
|
The plugin uses Lua to do magic things. It basically allows to call plugins written in Lua.
What a Lua script can do is not really limited by design, so any kind of plugin may be implemented. The lua plugin is especially useful to write filter and logging scripts.
See installation. The package is called libelektra5-lua
.
The lua plugin accepts only the script configuration parameter holding the path to a Lua script. The mount command would look like
if the ini plugin should be used for storage and the lua plugin only serves to invoke the filter script.
For a Lua script that serves as (JSON) storage plugin itself, one could also use
Lua scripts can implement the following functions
where config & returned are KeySets and errorKey & parentKey are Keys. For the return codes of the functions, the same rules as for normal plugins apply.
If a function is not available, it simply is not called. A script does not have to implement all functions therefore.
Access to kdb can be retrieved using the Lua import
An example script that prints some information for each method call would be:
Further examples can be found in the lua directory.
Note, this is a technical preview. It might have severe bugs and the API might change in the future.
Be also aware that a Lua script will never be as performant as a native C/C++ plugin. Spinning up the interpreter takes additional time and resources.