I can't create a named UCI section via lua. The equivalent using the command line is
uci set uhttpd.test=uhttpd
uci commit
Which gives a config file like
config uhttpd 'test'
I can't reproduce the syntax of the command-line with set or add. The C source seems to say there is away to pass type to add
local uci = require "uci"
uci.add("uhttpd", "test") -- adds anonymous section
uci.set("uhttpd", "test", "listen_http", "0.0.0.0:81") -- not added as named section missing
uci.commit("uhttpd")
From the wiki:
Add new section "name" with type "type":
x:set("config", "name", "type")
-- real world example:
x:set("network", "wan6", "interface")