From: Jo-Philipp Wich Date: Thu, 17 Dec 2015 01:39:23 +0000 (+0100) Subject: Merge pull request #464 from remakeelectric/pulls/list-operations X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=967bb1f36f9f30d19e13aecf3a550eea5fd73c6b;hp=-c Merge pull request #464 from remakeelectric/pulls/list-operations get/set list operations and documentation --- 967bb1f36f9f30d19e13aecf3a550eea5fd73c6b diff --combined modules/luci-base/luasrc/model/uci.luadoc index 7591b68b0,9e4a58f1d..49093c793 --- a/modules/luci-base/luasrc/model/uci.luadoc +++ b/modules/luci-base/luasrc/model/uci.luadoc @@@ -88,7 -88,8 +88,8 @@@ Get an option or list and return value @param config UCI config @param section UCI section name @param option UCI option - @return UCI value + @return table. If the option was not found, you will simply get + -- an empty table. ]] ---[[ @@@ -104,14 -105,15 +105,15 @@@ Get the given option from the first sec ]] ---[[ - Set given values as list. + Set given values as list. Setting a list option to an empty list + has the same effect as deleting the option. @class function @name Cursor.set_list @param config UCI config @param section UCI section name @param option UCI option - @param value UCI value + @param value value or table. Raw values will become a single item table. @return Boolean whether operation succeeded ]] @@@ -235,18 -237,12 +237,18 @@@ Saves changes made to a config to make ---[[ Set a value or create a named section. +When invoked with three arguments `config`, `sectionname`, `sectiontype`, +then a named section of the given type is created. + +When invoked with four arguments `config`, `sectionname`, `optionname` and +`optionvalue` then the value of the specified option is set to the given value. + @class function @name Cursor.set @param config UCI config @param section UCI section name @param option UCI option or UCI section type -@param value UCI value or nil if you want to create a section +@param value UCI value or nothing if you want to create a section @return Boolean whether operation succeeded ]]