lua: change the Conf API to have methods for getting sections as specific types

In some cases we need to get a section as JSON, so that we can pass it
down to the rules parser, while in other cases we neeed to get it as a
table to use it natively, and in that case we even need to differentiate
between it being an object, an array or an object with WpProperties.

Make it also possible to optionally pass tables with default values to
the functions so that we can get rid of cutils.get_config_section()
as well.
This commit is contained in:
George Kiagiadakis
2024-03-04 16:27:37 +02:00
parent 91b5ba5e92
commit 3fbf1286e6
12 changed files with 113 additions and 82 deletions

View File

@@ -11,12 +11,8 @@
log = Log.open_topic ("s-node")
defaults = {}
defaults.virtual_items = Json.Object {}
config = {}
config.virtual_items = Conf.get_section (
"virtual-items", defaults.virtual_items):parse ()
config.virtual_items = Conf.get_section_as_object ("virtual-items")
function createVirtualItem (factory_name, properties)
-- create virtual item