In some projects (e.g. babeld) is important how sections are ordered. The arrangement represents at the end e.g. the passing through different rules.
Currently I'm doing this:
uci add babeld filter
uci set babeld.@filter[-1].type='redistribute'
uci set babeld.@filter[-1].ip=$1
uci set babeld.@filter[-1].local='true'
uci set babeld.@filter[-1].action='deny'
This just appends to a config file and results that the rules never apply.
If you don't use uci add you can just overwrite any currently existing filter using something like:
uci set babeld.@filter["$n"].type='redistribute'
uci set babeld.@filter["$n"].ip=$1
uci set babeld.@filter["$n"].local='true'
uci set babeld.@filter["$n"].action='deny'
Maybe you could contribute to the patch which would implement uci --insert add (a-la iptables -I option): use normal add, get n -- the number of matching sections, in the loop for i in n to 1 copy section options from [i-1] to [i] and delete options from [0].
Once you do uci --insert add, you can then write the new values to @filter[0].