X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fuci%2Fluasrc%2Fmodel%2Fuci.lua;h=3b135c532aae867b369326600784ba044a923f89;hp=9af5560da53d793088526475d688ac7e0df68c11;hb=e068351a3f5bf63ed85cd5d67a4a71048c5c0f60;hpb=ccb1ea29ac5fc0976a15672fdc73af9186c5e1bb diff --git a/libs/uci/luasrc/model/uci.lua b/libs/uci/luasrc/model/uci.lua index 9af5560da..3b135c532 100644 --- a/libs/uci/luasrc/model/uci.lua +++ b/libs/uci/luasrc/model/uci.lua @@ -24,7 +24,7 @@ limitations under the License. ]]-- local os = require "os" -local uci = require "uci2" +local uci = require "uci" local util = require "luci.util" local table = require "table" @@ -34,18 +34,24 @@ local error, pairs, ipairs, tostring = error, pairs, ipairs, tostring local require, getmetatable = require, getmetatable --- LuCI UCI model library. +-- @cstyle instance module("luci.model.uci") +--- Create a new UCI-Cursor. +-- @class function +-- @name cursor +-- @return UCI-Cursor cursor = uci.cursor + APIVERSION = uci.APIVERSION ---- Creates a new statevalue cursor +--- Create a new Cursor initialized to the state directory. -- @return UCI cursor function cursor_state() return cursor(nil, "/var/state") end ---- UCI-Cursor + local Cursor = getmetatable(cursor()) --- Applies the new config @@ -159,7 +165,7 @@ end -- @name Cursor.commit -- @param config UCI config -- @return Boolean whether operation succeeded --- @see revert +-- @see Cursor.revert --- Deletes a section or an option. -- @class function @@ -193,30 +199,27 @@ end -- @return Table of UCI sections or table of UCI values --- Manually load a config. --- Warning: This function is unsave! You should use load_config or load_state if possible. -- @class function -- @name Cursor.load -- @param config UCI config -- @return Boolean whether operation succeeded --- @see load_config --- @see load_state --- @see save --- @see unload +-- @see Cursor.save +-- @see Cursor.unload --- Revert unsaved changes. -- @class function -- @name Cursor.revert -- @param config UCI config -- @return Boolean whether operation succeeded --- @see commit +-- @see Cursor.commit --- Saves changes made to a config to make them committable. -- @class function -- @name Cursor.save -- @param config UCI config -- @return Boolean whether operation succeeded --- @see load --- @see unload +-- @see Cursor.load +-- @see Cursor.unload --- Set a value or create a named section. -- @class function @@ -254,5 +257,5 @@ end -- @name Cursor.unload -- @param config UCI config -- @return Boolean whether operation succeeded --- @see load --- @see save +-- @see Cursor.load +-- @see Cursor.save