1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <title>Reference</title>
6 <link rel="stylesheet" href="../luadoc.css" type="text/css" />
7 <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
14 <div id="product_logo"></div>
15 <div id="product_name"><big><b></b></big></div>
16 <div id="product_description"></div>
17 </div> <!-- id="product" -->
27 <li><a href="../index.html">Index</a></li>
38 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
42 <a href="../modules/luci.http.html">luci.http</a>
46 <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
50 <a href="../modules/luci.http.date.html">luci.http.date</a>
54 <a href="../modules/luci.http.mime.html">luci.http.mime</a>
58 <a href="../modules/luci.i18n.html">luci.i18n</a>
62 <a href="../modules/luci.ip.html">luci.ip</a>
66 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
70 <a href="../modules/luci.json.html">luci.json</a>
74 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
78 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
82 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
85 <li><strong>luci.model.uci</strong></li>
88 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
92 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
96 <a href="../modules/luci.sys.html">luci.sys</a>
100 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
104 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
108 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
112 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
116 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
120 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
124 <a href="../modules/luci.util.html">luci.util</a>
128 <a href="../modules/nixio.html">nixio</a>
132 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
136 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
140 <a href="../modules/nixio.File.html">nixio.File</a>
144 <a href="../modules/nixio.README.html">nixio.README</a>
148 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
152 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
156 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
160 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
164 <a href="../modules/nixio.bin.html">nixio.bin</a>
168 <a href="../modules/nixio.bit.html">nixio.bit</a>
172 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
176 <a href="../modules/nixio.fs.html">nixio.fs</a>
191 </div><!-- id="navigation" -->
195 <h1>Object Instance <code>luci.model.uci</code></h1>
206 <table class="function_list">
209 <td class="name" nowrap><a href="#Cursor.add">Cursor:add</a> (config, type)</td>
212 Add an anonymous section.</td>
216 <td class="name" nowrap><a href="#Cursor.apply">Cursor:apply</a> (configlist, command)</td>
219 Applies UCI configuration changes
224 <td class="name" nowrap><a href="#Cursor.changes">Cursor:changes</a> (config)</td>
227 Get a table of saved but uncommitted changes.</td>
231 <td class="name" nowrap><a href="#Cursor.commit">Cursor:commit</a> (config)</td>
234 Commit saved changes.</td>
238 <td class="name" nowrap><a href="#Cursor.delete">Cursor:delete</a> (config, section, option)</td>
241 Deletes a section or an option.</td>
245 <td class="name" nowrap><a href="#Cursor.delete_all">Cursor:delete_all</a> (config, type, comparator)</td>
248 Delete all sections of a given type that match certain criteria.</td>
252 <td class="name" nowrap><a href="#Cursor.foreach">Cursor:foreach</a> (config, type, callback)</td>
255 Call a function for every section of a certain type.</td>
259 <td class="name" nowrap><a href="#Cursor.get">Cursor:get</a> (config, section, option)</td>
262 Get a section type or an option
267 <td class="name" nowrap><a href="#Cursor.get_all">Cursor:get_all</a> (config, section)</td>
270 Get all sections of a config or all values of a section.</td>
274 <td class="name" nowrap><a href="#Cursor.get_bool">Cursor:get_bool</a> (config, section, option)</td>
277 Get a boolean option and return it's value as true or false.</td>
281 <td class="name" nowrap><a href="#Cursor.get_confdir">Cursor:get_confdir</a> ()</td>
284 Get the configuration directory.</td>
288 <td class="name" nowrap><a href="#Cursor.get_first">Cursor:get_first</a> (config, type, option, default)</td>
291 Get the given option from the first section with the given type.</td>
295 <td class="name" nowrap><a href="#Cursor.get_list">Cursor:get_list</a> (config, section, option)</td>
298 Get an option or list and return values as table.</td>
302 <td class="name" nowrap><a href="#Cursor.get_savedir">Cursor:get_savedir</a> ()</td>
305 Get the directory for uncomitted changes.</td>
309 <td class="name" nowrap><a href="#Cursor.get_session_id">Cursor:get_session_id</a> ()</td>
312 Get the effective session ID.</td>
316 <td class="name" nowrap><a href="#Cursor.load">Cursor:load</a> (config)</td>
319 Manually load a config.</td>
323 <td class="name" nowrap><a href="#Cursor.revert">Cursor:revert</a> (config)</td>
326 Revert saved but uncommitted changes.</td>
330 <td class="name" nowrap><a href="#Cursor.save">Cursor:save</a> (config)</td>
333 Saves changes made to a config to make them committable.</td>
337 <td class="name" nowrap><a href="#Cursor.section">Cursor:section</a> (config, type, name, values)</td>
340 Create a new section and initialize it with data.</td>
344 <td class="name" nowrap><a href="#Cursor.set">Cursor:set</a> (config, section, option, value)</td>
347 Set a value or create a named section.</td>
351 <td class="name" nowrap><a href="#Cursor.set_confdir">Cursor:set_confdir</a> (directory)</td>
354 Set the configuration directory.</td>
358 <td class="name" nowrap><a href="#Cursor.set_list">Cursor:set_list</a> (config, section, option, value)</td>
361 Set given values as list.</td>
365 <td class="name" nowrap><a href="#Cursor.set_savedir">Cursor:set_savedir</a> (directory)</td>
368 Set the directory for uncommited changes.</td>
372 <td class="name" nowrap><a href="#Cursor.set_session_id">Cursor:set_session_id</a> (id)</td>
375 Set the effective session ID.</td>
379 <td class="name" nowrap><a href="#Cursor.substate">Cursor:substate</a> ()</td>
382 Create a sub-state of this cursor.</td>
386 <td class="name" nowrap><a href="#Cursor.tset">Cursor:tset</a> (config, section, values)</td>
389 Updated the data of a section using data from a table.</td>
393 <td class="name" nowrap><a href="#Cursor.unload">Cursor:unload</a> (config)</td>
396 Discard changes made to a config.</td>
400 <td class="name" nowrap><a href="#cursor">cursor</a> ()</td>
403 Create a new UCI-Cursor.</td>
407 <td class="name" nowrap><a href="#cursor_state">cursor_state</a> ()</td>
410 Create a new Cursor initialized to the state directory.</td>
424 <h2><a name="functions"></a>Functions</h2>
425 <dl class="function">
429 <dt><a name="Cursor.add"></a><strong>Cursor:add</strong> (config, type)</dt>
433 Add an anonymous section.
445 type: UCI section type
455 <h3>Return value:</h3>
456 Name of created section
465 <dt><a name="Cursor.apply"></a><strong>Cursor:apply</strong> (configlist, command)</dt>
469 Applies UCI configuration changes
477 configlist: List of UCI configurations
481 command: Don't apply only return the command
498 <dt><a name="Cursor.changes"></a><strong>Cursor:changes</strong> (config)</dt>
502 Get a table of saved but uncommitted changes.
520 <h3>Return value:</h3>
528 <li><a href="#Cursor.save">
539 <dt><a name="Cursor.commit"></a><strong>Cursor:commit</strong> (config)</dt>
543 Commit saved changes.
561 <h3>Return value:</h3>
562 Boolean whether operation succeeded
569 <li><a href="#Cursor.revert">
573 <li><a href="#Cursor.save">
584 <dt><a name="Cursor.delete"></a><strong>Cursor:delete</strong> (config, section, option)</dt>
588 Deletes a section or an option.
600 section: UCI section name
604 option: UCI option (optional)
614 <h3>Return value:</h3>
615 Boolean whether operation succeeded
624 <dt><a name="Cursor.delete_all"></a><strong>Cursor:delete_all</strong> (config, type, comparator)</dt>
628 Delete all sections of a given type that match certain criteria.
640 type: UCI section type
644 comparator: Function that will be called for each section and returns
645 a boolean whether to delete the current section (optional)
662 <dt><a name="Cursor.foreach"></a><strong>Cursor:foreach</strong> (config, type, callback)</dt>
666 Call a function for every section of a certain type.
678 type: UCI section type
682 callback: Function to be called
692 <h3>Return value:</h3>
693 Boolean whether operation succeeded
702 <dt><a name="Cursor.get"></a><strong>Cursor:get</strong> (config, section, option)</dt>
706 Get a section type or an option
718 section: UCI section name
722 option: UCI option (optional)
732 <h3>Return value:</h3>
742 <dt><a name="Cursor.get_all"></a><strong>Cursor:get_all</strong> (config, section)</dt>
746 Get all sections of a config or all values of a section.
758 section: UCI section name (optional)
768 <h3>Return value:</h3>
769 Table of UCI sections or table of UCI values
778 <dt><a name="Cursor.get_bool"></a><strong>Cursor:get_bool</strong> (config, section, option)</dt>
782 Get a boolean option and return it's value as true or false.
794 section: UCI section name
808 <h3>Return value:</h3>
818 <dt><a name="Cursor.get_confdir"></a><strong>Cursor:get_confdir</strong> ()</dt>
822 Get the configuration directory.
831 <h3>Return value:</h3>
832 Configuration directory
841 <dt><a name="Cursor.get_first"></a><strong>Cursor:get_first</strong> (config, type, option, default)</dt>
845 Get the given option from the first section with the given type.
857 type: UCI section type
861 option: UCI option (optional)
865 default: Default value (optional)
875 <h3>Return value:</h3>
885 <dt><a name="Cursor.get_list"></a><strong>Cursor:get_list</strong> (config, section, option)</dt>
889 Get an option or list and return values as table.
901 section: UCI section name
915 <h3>Return value:</h3>
916 table. If the option was not found, you will simply get an empty
926 <dt><a name="Cursor.get_savedir"></a><strong>Cursor:get_savedir</strong> ()</dt>
930 Get the directory for uncomitted changes.
939 <h3>Return value:</h3>
949 <dt><a name="Cursor.get_session_id"></a><strong>Cursor:get_session_id</strong> ()</dt>
953 Get the effective session ID.
962 <h3>Return value:</h3>
963 String containing the session ID
972 <dt><a name="Cursor.load"></a><strong>Cursor:load</strong> (config)</dt>
976 Manually load a config.
994 <h3>Return value:</h3>
995 Boolean whether operation succeeded
1002 <li><a href="#Cursor.save">
1006 <li><a href="#Cursor.unload">
1017 <dt><a name="Cursor.revert"></a><strong>Cursor:revert</strong> (config)</dt>
1021 Revert saved but uncommitted changes.
1039 <h3>Return value:</h3>
1040 Boolean whether operation succeeded
1047 <li><a href="#Cursor.commit">
1051 <li><a href="#Cursor.save">
1062 <dt><a name="Cursor.save"></a><strong>Cursor:save</strong> (config)</dt>
1066 Saves changes made to a config to make them committable.
1084 <h3>Return value:</h3>
1085 Boolean whether operation succeeded
1092 <li><a href="#Cursor.load">
1096 <li><a href="#Cursor.unload">
1107 <dt><a name="Cursor.section"></a><strong>Cursor:section</strong> (config, type, name, values)</dt>
1111 Create a new section and initialize it with data.
1123 type: UCI section type
1127 name: UCI section name (optional)
1131 values: Table of key - value pairs to initialize the section with
1141 <h3>Return value:</h3>
1142 Name of created section
1151 <dt><a name="Cursor.set"></a><strong>Cursor:set</strong> (config, section, option, value)</dt>
1155 Set a value or create a named section.
1157 When invoked with three arguments <code>config</code>, <code>sectionname</code>, <code>sectiontype</code>,
1158 then a named section of the given type is created.
1160 When invoked with four arguments <code>config</code>, <code>sectionname</code>, <code>optionname</code> and
1161 <code>optionvalue</code> then the value of the specified option is set to the given value.
1173 section: UCI section name
1177 option: UCI option or UCI section type
1181 value: UCI value or nothing if you want to create a section
1191 <h3>Return value:</h3>
1192 Boolean whether operation succeeded
1201 <dt><a name="Cursor.set_confdir"></a><strong>Cursor:set_confdir</strong> (directory)</dt>
1205 Set the configuration directory.
1213 directory: UCI configuration directory
1223 <h3>Return value:</h3>
1224 Boolean whether operation succeeded
1233 <dt><a name="Cursor.set_list"></a><strong>Cursor:set_list</strong> (config, section, option, value)</dt>
1237 Set given values as list. Setting a list option to an empty list
1238 has the same effect as deleting the option.
1250 section: UCI section name
1258 value: Value or table. Non-table values will be set as single
1269 <h3>Return value:</h3>
1270 Boolean whether operation succeeded
1279 <dt><a name="Cursor.set_savedir"></a><strong>Cursor:set_savedir</strong> (directory)</dt>
1283 Set the directory for uncommited changes.
1291 directory: UCI changes directory
1301 <h3>Return value:</h3>
1302 Boolean whether operation succeeded
1311 <dt><a name="Cursor.set_session_id"></a><strong>Cursor:set_session_id</strong> (id)</dt>
1315 Set the effective session ID.
1323 id: String containing the session ID to set
1333 <h3>Return value:</h3>
1334 Boolean whether operation succeeded
1343 <dt><a name="Cursor.substate"></a><strong>Cursor:substate</strong> ()</dt>
1347 Create a sub-state of this cursor.
1349 The sub-state is tied to the parent curser, means it the parent unloads or
1350 loads configs, the sub state will do so as well.
1359 <h3>Return value:</h3>
1360 UCI state cursor tied to the parent cursor
1369 <dt><a name="Cursor.tset"></a><strong>Cursor:tset</strong> (config, section, values)</dt>
1373 Updated the data of a section using data from a table.
1385 section: UCI section name (optional)
1389 values: Table of key - value pairs to update the section with
1406 <dt><a name="Cursor.unload"></a><strong>Cursor:unload</strong> (config)</dt>
1410 Discard changes made to a config.
1428 <h3>Return value:</h3>
1429 Boolean whether operation succeeded
1436 <li><a href="#Cursor.load">
1440 <li><a href="#Cursor.save">
1451 <dt><a name="cursor"></a><strong>cursor</strong> ()</dt>
1455 Create a new UCI-Cursor.
1464 <h3>Return value:</h3>
1474 <dt><a name="cursor_state"></a><strong>cursor_state</strong> ()</dt>
1478 Create a new Cursor initialized to the state directory.
1487 <h3>Return value:</h3>
1501 </div> <!-- id="content" -->
1503 </div> <!-- id="main" -->
1506 <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
1507 </div> <!-- id="about" -->
1509 </div> <!-- id="container" -->