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.protocol.html">luci.http.protocol
</a>
50 <a href=
"../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals
</a>
54 <a href=
"../modules/luci.http.protocol.date.html">luci.http.protocol.date
</a>
58 <a href=
"../modules/luci.http.protocol.mime.html">luci.http.protocol.mime
</a>
62 <a href=
"../modules/luci.i18n.html">luci.i18n
</a>
66 <a href=
"../modules/luci.ip.html">luci.ip
</a>
70 <a href=
"../modules/luci.ip.cidr.html">luci.ip.cidr
</a>
74 <a href=
"../modules/luci.json.html">luci.json
</a>
78 <a href=
"../modules/luci.jsonc.html">luci.jsonc
</a>
82 <a href=
"../modules/luci.jsonc.parser.html">luci.jsonc.parser
</a>
86 <a href=
"../modules/luci.model.ipkg.html">luci.model.ipkg
</a>
89 <li><strong>luci.model.uci
</strong></li>
92 <a href=
"../modules/luci.rpcc.html">luci.rpcc
</a>
96 <a href=
"../modules/luci.rpcc.ruci.html">luci.rpcc.ruci
</a>
100 <a href=
"../modules/luci.sys.html">luci.sys
</a>
104 <a href=
"../modules/luci.sys.init.html">luci.sys.init
</a>
108 <a href=
"../modules/luci.sys.iptparser.html">luci.sys.iptparser
</a>
112 <a href=
"../modules/luci.sys.net.html">luci.sys.net
</a>
116 <a href=
"../modules/luci.sys.process.html">luci.sys.process
</a>
120 <a href=
"../modules/luci.sys.user.html">luci.sys.user
</a>
124 <a href=
"../modules/luci.sys.wifi.html">luci.sys.wifi
</a>
128 <a href=
"../modules/luci.util.html">luci.util
</a>
132 <a href=
"../modules/nixio.html">nixio
</a>
136 <a href=
"../modules/nixio.CHANGELOG.html">nixio.CHANGELOG
</a>
140 <a href=
"../modules/nixio.CryptoHash.html">nixio.CryptoHash
</a>
144 <a href=
"../modules/nixio.File.html">nixio.File
</a>
148 <a href=
"../modules/nixio.README.html">nixio.README
</a>
152 <a href=
"../modules/nixio.Socket.html">nixio.Socket
</a>
156 <a href=
"../modules/nixio.TLSContext.html">nixio.TLSContext
</a>
160 <a href=
"../modules/nixio.TLSSocket.html">nixio.TLSSocket
</a>
164 <a href=
"../modules/nixio.UnifiedIO.html">nixio.UnifiedIO
</a>
168 <a href=
"../modules/nixio.bin.html">nixio.bin
</a>
172 <a href=
"../modules/nixio.bit.html">nixio.bit
</a>
176 <a href=
"../modules/nixio.crypto.html">nixio.crypto
</a>
180 <a href=
"../modules/nixio.fs.html">nixio.fs
</a>
195 </div><!-- id="navigation" -->
199 <h1>Object Instance
<code>luci.model.uci
</code></h1>
210 <table class=
"function_list">
213 <td class=
"name" nowrap
><a href=
"#Cursor.add">Cursor:add
</a> (config, type)
</td>
216 Add an anonymous section.
</td>
220 <td class=
"name" nowrap
><a href=
"#Cursor.apply">Cursor:apply
</a> (configlist, command)
</td>
223 Applies UCI configuration changes
228 <td class=
"name" nowrap
><a href=
"#Cursor.changes">Cursor:changes
</a> (config)
</td>
231 Get a table of saved but uncommitted changes.
</td>
235 <td class=
"name" nowrap
><a href=
"#Cursor.commit">Cursor:commit
</a> (config)
</td>
238 Commit saved changes.
</td>
242 <td class=
"name" nowrap
><a href=
"#Cursor.delete">Cursor:delete
</a> (config, section, option)
</td>
245 Deletes a section or an option.
</td>
249 <td class=
"name" nowrap
><a href=
"#Cursor.delete_all">Cursor:delete_all
</a> (config, type, comparator)
</td>
252 Delete all sections of a given type that match certain criteria.
</td>
256 <td class=
"name" nowrap
><a href=
"#Cursor.foreach">Cursor:foreach
</a> (config, type, callback)
</td>
259 Call a function for every section of a certain type.
</td>
263 <td class=
"name" nowrap
><a href=
"#Cursor.get">Cursor:get
</a> (config, section, option)
</td>
266 Get a section type or an option
271 <td class=
"name" nowrap
><a href=
"#Cursor.get_all">Cursor:get_all
</a> (config, section)
</td>
274 Get all sections of a config or all values of a section.
</td>
278 <td class=
"name" nowrap
><a href=
"#Cursor.get_bool">Cursor:get_bool
</a> (config, section, option)
</td>
281 Get a boolean option and return it's value as true or false.
</td>
285 <td class=
"name" nowrap
><a href=
"#Cursor.get_confdir">Cursor:get_confdir
</a> ()
</td>
288 Get the configuration directory.
</td>
292 <td class=
"name" nowrap
><a href=
"#Cursor.get_first">Cursor:get_first
</a> (config, type, option, default)
</td>
295 Get the given option from the first section with the given type.
</td>
299 <td class=
"name" nowrap
><a href=
"#Cursor.get_list">Cursor:get_list
</a> (config, section, option)
</td>
302 Get an option or list and return values as table.
</td>
306 <td class=
"name" nowrap
><a href=
"#Cursor.get_savedir">Cursor:get_savedir
</a> ()
</td>
309 Get the directory for uncomitted changes.
</td>
313 <td class=
"name" nowrap
><a href=
"#Cursor.load">Cursor:load
</a> (config)
</td>
316 Manually load a config.
</td>
320 <td class=
"name" nowrap
><a href=
"#Cursor.revert">Cursor:revert
</a> (config)
</td>
323 Revert saved but uncommitted changes.
</td>
327 <td class=
"name" nowrap
><a href=
"#Cursor.save">Cursor:save
</a> (config)
</td>
330 Saves changes made to a config to make them committable.
</td>
334 <td class=
"name" nowrap
><a href=
"#Cursor.section">Cursor:section
</a> (config, type, name, values)
</td>
337 Create a new section and initialize it with data.
</td>
341 <td class=
"name" nowrap
><a href=
"#Cursor.set">Cursor:set
</a> (config, section, option, value)
</td>
344 Set a value or create a named section.
</td>
348 <td class=
"name" nowrap
><a href=
"#Cursor.set_confdir">Cursor:set_confdir
</a> (directory)
</td>
351 Set the configuration directory.
</td>
355 <td class=
"name" nowrap
><a href=
"#Cursor.set_list">Cursor:set_list
</a> (config, section, option, value)
</td>
358 Set given values as list.
</td>
362 <td class=
"name" nowrap
><a href=
"#Cursor.set_savedir">Cursor:set_savedir
</a> (directory)
</td>
365 Set the directory for uncommited changes.
</td>
369 <td class=
"name" nowrap
><a href=
"#Cursor.substate">Cursor:substate
</a> ()
</td>
372 Create a sub-state of this cursor.
</td>
376 <td class=
"name" nowrap
><a href=
"#Cursor.tset">Cursor:tset
</a> (config, section, values)
</td>
379 Updated the data of a section using data from a table.
</td>
383 <td class=
"name" nowrap
><a href=
"#Cursor.unload">Cursor:unload
</a> (config)
</td>
386 Discard changes made to a config.
</td>
390 <td class=
"name" nowrap
><a href=
"#cursor">cursor
</a> ()
</td>
393 Create a new UCI-Cursor.
</td>
397 <td class=
"name" nowrap
><a href=
"#cursor_state">cursor_state
</a> ()
</td>
400 Create a new Cursor initialized to the state directory.
</td>
414 <h2><a name=
"functions"></a>Functions
</h2>
415 <dl class=
"function">
419 <dt><a name=
"Cursor.add"></a><strong>Cursor:add
</strong> (config, type)
</dt>
423 Add an anonymous section.
435 type: UCI section type
445 <h3>Return value:
</h3>
446 Name of created section
455 <dt><a name=
"Cursor.apply"></a><strong>Cursor:apply
</strong> (configlist, command)
</dt>
459 Applies UCI configuration changes
467 configlist: List of UCI configurations
471 command: Don't apply only return the command
488 <dt><a name=
"Cursor.changes"></a><strong>Cursor:changes
</strong> (config)
</dt>
492 Get a table of saved but uncommitted changes.
510 <h3>Return value:
</h3>
518 <li><a href=
"#Cursor.save">
529 <dt><a name=
"Cursor.commit"></a><strong>Cursor:commit
</strong> (config)
</dt>
533 Commit saved changes.
551 <h3>Return value:
</h3>
552 Boolean whether operation succeeded
559 <li><a href=
"#Cursor.revert">
563 <li><a href=
"#Cursor.save">
574 <dt><a name=
"Cursor.delete"></a><strong>Cursor:delete
</strong> (config, section, option)
</dt>
578 Deletes a section or an option.
590 section: UCI section name
594 option: UCI option (optional)
604 <h3>Return value:
</h3>
605 Boolean whether operation succeeded
614 <dt><a name=
"Cursor.delete_all"></a><strong>Cursor:delete_all
</strong> (config, type, comparator)
</dt>
618 Delete all sections of a given type that match certain criteria.
630 type: UCI section type
634 comparator: Function that will be called for each section and
635 returns a boolean whether to delete the current section (optional)
652 <dt><a name=
"Cursor.foreach"></a><strong>Cursor:foreach
</strong> (config, type, callback)
</dt>
656 Call a function for every section of a certain type.
668 type: UCI section type
672 callback: Function to be called
682 <h3>Return value:
</h3>
683 Boolean whether operation succeeded
692 <dt><a name=
"Cursor.get"></a><strong>Cursor:get
</strong> (config, section, option)
</dt>
696 Get a section type or an option
708 section: UCI section name
712 option: UCI option (optional)
722 <h3>Return value:
</h3>
732 <dt><a name=
"Cursor.get_all"></a><strong>Cursor:get_all
</strong> (config, section)
</dt>
736 Get all sections of a config or all values of a section.
748 section: UCI section name (optional)
758 <h3>Return value:
</h3>
759 Table of UCI sections or table of UCI values
768 <dt><a name=
"Cursor.get_bool"></a><strong>Cursor:get_bool
</strong> (config, section, option)
</dt>
772 Get a boolean option and return it's value as true or false.
784 section: UCI section name
798 <h3>Return value:
</h3>
808 <dt><a name=
"Cursor.get_confdir"></a><strong>Cursor:get_confdir
</strong> ()
</dt>
812 Get the configuration directory.
821 <h3>Return value:
</h3>
822 Configuration directory
831 <dt><a name=
"Cursor.get_first"></a><strong>Cursor:get_first
</strong> (config, type, option, default)
</dt>
835 Get the given option from the first section with the given type.
847 type: UCI section type
851 option: UCI option (optional)
855 default: Default value (optional)
865 <h3>Return value:
</h3>
875 <dt><a name=
"Cursor.get_list"></a><strong>Cursor:get_list
</strong> (config, section, option)
</dt>
879 Get an option or list and return values as table.
891 section: UCI section name
905 <h3>Return value:
</h3>
906 table. If the option was not found, you will simply get
916 <dt><a name=
"Cursor.get_savedir"></a><strong>Cursor:get_savedir
</strong> ()
</dt>
920 Get the directory for uncomitted changes.
929 <h3>Return value:
</h3>
939 <dt><a name=
"Cursor.load"></a><strong>Cursor:load
</strong> (config)
</dt>
943 Manually load a config.
961 <h3>Return value:
</h3>
962 Boolean whether operation succeeded
969 <li><a href=
"#Cursor.save">
973 <li><a href=
"#Cursor.unload">
984 <dt><a name=
"Cursor.revert"></a><strong>Cursor:revert
</strong> (config)
</dt>
988 Revert saved but uncommitted changes.
1006 <h3>Return value:
</h3>
1007 Boolean whether operation succeeded
1014 <li><a href=
"#Cursor.commit">
1018 <li><a href=
"#Cursor.save">
1029 <dt><a name=
"Cursor.save"></a><strong>Cursor:save
</strong> (config)
</dt>
1033 Saves changes made to a config to make them committable.
1051 <h3>Return value:
</h3>
1052 Boolean whether operation succeeded
1059 <li><a href=
"#Cursor.load">
1063 <li><a href=
"#Cursor.unload">
1074 <dt><a name=
"Cursor.section"></a><strong>Cursor:section
</strong> (config, type, name, values)
</dt>
1078 Create a new section and initialize it with data.
1090 type: UCI section type
1094 name: UCI section name (optional)
1098 values: Table of key - value pairs to initialize the section with
1108 <h3>Return value:
</h3>
1109 Name of created section
1118 <dt><a name=
"Cursor.set"></a><strong>Cursor:set
</strong> (config, section, option, value)
</dt>
1122 Set a value or create a named section.
1124 When invoked with three arguments
<code>config
</code>,
<code>sectionname
</code>,
<code>sectiontype
</code>,
1125 then a named section of the given type is created.
1127 When invoked with four arguments
<code>config
</code>,
<code>sectionname
</code>,
<code>optionname
</code> and
1128 <code>optionvalue
</code> then the value of the specified option is set to the given value.
1140 section: UCI section name
1144 option: UCI option or UCI section type
1148 value: UCI value or nothing if you want to create a section
1158 <h3>Return value:
</h3>
1159 Boolean whether operation succeeded
1168 <dt><a name=
"Cursor.set_confdir"></a><strong>Cursor:set_confdir
</strong> (directory)
</dt>
1172 Set the configuration directory.
1180 directory: UCI configuration directory
1190 <h3>Return value:
</h3>
1191 Boolean whether operation succeeded
1200 <dt><a name=
"Cursor.set_list"></a><strong>Cursor:set_list
</strong> (config, section, option, value)
</dt>
1204 Set given values as list. Setting a list option to an empty list
1205 has the same effect as deleting the option.
1217 section: UCI section name
1225 value: value or table. Raw values will become a single item table.
1235 <h3>Return value:
</h3>
1236 Boolean whether operation succeeded
1245 <dt><a name=
"Cursor.set_savedir"></a><strong>Cursor:set_savedir
</strong> (directory)
</dt>
1249 Set the directory for uncommited changes.
1257 directory: UCI changes directory
1267 <h3>Return value:
</h3>
1268 Boolean whether operation succeeded
1277 <dt><a name=
"Cursor.substate"></a><strong>Cursor:substate
</strong> ()
</dt>
1281 Create a sub-state of this cursor. The sub-state is tied to the parent
1283 curser, means it the parent unloads or loads configs, the sub state will
1292 <h3>Return value:
</h3>
1293 UCI state cursor tied to the parent cursor
1302 <dt><a name=
"Cursor.tset"></a><strong>Cursor:tset
</strong> (config, section, values)
</dt>
1306 Updated the data of a section using data from a table.
1318 section: UCI section name (optional)
1322 values: Table of key - value pairs to update the section with
1339 <dt><a name=
"Cursor.unload"></a><strong>Cursor:unload
</strong> (config)
</dt>
1343 Discard changes made to a config.
1361 <h3>Return value:
</h3>
1362 Boolean whether operation succeeded
1369 <li><a href=
"#Cursor.load">
1373 <li><a href=
"#Cursor.save">
1384 <dt><a name=
"cursor"></a><strong>cursor
</strong> ()
</dt>
1388 Create a new UCI-Cursor.
1397 <h3>Return value:
</h3>
1407 <dt><a name=
"cursor_state"></a><strong>cursor_state
</strong> ()
</dt>
1411 Create a new Cursor initialized to the state directory.
1420 <h3>Return value:
</h3>
1434 </div> <!-- id="content" -->
1436 </div> <!-- id="main" -->
1439 <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>
1440 </div> <!-- id="about" -->
1442 </div> <!-- id="container" -->