summaryrefslogtreecommitdiffhomepage
path: root/docs/api/modules/luci.util.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/api/modules/luci.util.html')
-rw-r--r--docs/api/modules/luci.util.html1830
1 files changed, 1830 insertions, 0 deletions
diff --git a/docs/api/modules/luci.util.html b/docs/api/modules/luci.util.html
new file mode 100644
index 0000000000..f8baddf410
--- /dev/null
+++ b/docs/api/modules/luci.util.html
@@ -0,0 +1,1830 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+ <title>Reference</title>
+ <link rel="stylesheet" href="../luadoc.css" type="text/css" />
+ <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
+</head>
+
+<body>
+<div id="container">
+
+<div id="product">
+ <div id="product_logo"></div>
+ <div id="product_name"><big><b></b></big></div>
+ <div id="product_description"></div>
+</div> <!-- id="product" -->
+
+<div id="main">
+
+<div id="navigation">
+
+
+<h1>LuaDoc</h1>
+<ul>
+
+ <li><a href="../index.html">Index</a></li>
+
+</ul>
+
+
+<!-- Module list -->
+
+<h1>Modules</h1>
+<ul>
+
+ <li>
+ <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.http.html">luci.http</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.http.date.html">luci.http.date</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.http.mime.html">luci.http.mime</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.i18n.html">luci.i18n</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.ip.html">luci.ip</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.json.html">luci.json</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.jsonc.html">luci.jsonc</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.model.uci.html">luci.model.uci</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.rpcc.html">luci.rpcc</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.sys.html">luci.sys</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.sys.init.html">luci.sys.init</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.sys.net.html">luci.sys.net</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.sys.process.html">luci.sys.process</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.sys.user.html">luci.sys.user</a>
+ </li>
+
+ <li>
+ <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
+ </li>
+
+ <li><strong>luci.util</strong></li>
+
+ <li>
+ <a href="../modules/nixio.html">nixio</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.File.html">nixio.File</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.README.html">nixio.README</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.Socket.html">nixio.Socket</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.bin.html">nixio.bin</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.bit.html">nixio.bit</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.crypto.html">nixio.crypto</a>
+ </li>
+
+ <li>
+ <a href="../modules/nixio.fs.html">nixio.fs</a>
+ </li>
+
+</ul>
+
+
+
+<!-- File list -->
+
+
+
+
+
+
+
+</div><!-- id="navigation" -->
+
+<div id="content">
+
+<h1>Class <code>luci.util</code></h1>
+
+<p></p>
+
+
+
+
+
+
+
+<h2>Functions</h2>
+<table class="function_list">
+
+ <tr>
+ <td class="name" nowrap><a href="#append">append</a>&nbsp;(src, ...)</td>
+ <td class="summary">
+
+Appends numerically indexed tables or single objects to a given table.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#bigendian">bigendian</a>&nbsp;()</td>
+ <td class="summary">
+
+Test whether the current system is operating in big endian mode.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#class">class</a>&nbsp;(base)</td>
+ <td class="summary">
+
+Create a Class object (Python-style object model).</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#clone">clone</a>&nbsp;(object, deep)</td>
+ <td class="summary">
+
+Clones the given object and return it's copy.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#cmatch">cmatch</a>&nbsp;(str, pattern)</td>
+ <td class="summary">
+
+Count the occurrences of given substring in given string.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#combine">combine</a>&nbsp;(tbl1, tbl2, ...)</td>
+ <td class="summary">
+
+Combines two or more numerically indexed tables and single objects into one table.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#contains">contains</a>&nbsp;(table, value)</td>
+ <td class="summary">
+
+Checks whether the given table contains the given value.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#copcall">copcall</a>&nbsp;(f, ...)</td>
+ <td class="summary">
+
+This is a coroutine-safe drop-in replacement for Lua's "pcall"-function
+ </td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#coxpcall">coxpcall</a>&nbsp;(f, err, ...)</td>
+ <td class="summary">
+
+This is a coroutine-safe drop-in replacement for Lua's "xpcall"-function
+ </td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#dumptable">dumptable</a>&nbsp;(t, maxdepth)</td>
+ <td class="summary">
+
+Recursively dumps a table to stdout, useful for testing and debugging.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#exec">exec</a>&nbsp;(command)</td>
+ <td class="summary">
+
+Execute given commandline and gather stdout.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#execi">execi</a>&nbsp;(command)</td>
+ <td class="summary">
+
+Return a line-buffered iterator over the output of given command.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#get_bytecode">get_bytecode</a>&nbsp;(val)</td>
+ <td class="summary">
+
+Return the current runtime bytecode of the given data.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#imatch">imatch</a>&nbsp;(val)</td>
+ <td class="summary">
+
+Return a matching iterator for the given value.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#instanceof">instanceof</a>&nbsp;(object, class)</td>
+ <td class="summary">
+
+Test whether the given object is an instance of the given class.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#keys">keys</a>&nbsp;(t)</td>
+ <td class="summary">
+
+Retrieve all keys of given associative table.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#kspairs">kspairs</a>&nbsp;(t)</td>
+ <td class="summary">
+
+Return a key, value iterator for the given table.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#libpath">libpath</a>&nbsp;()</td>
+ <td class="summary">
+
+Returns the absolute path to LuCI base directory.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#parse_units">parse_units</a>&nbsp;(ustr)</td>
+ <td class="summary">
+
+Parse certain units from the given string and return the canonical integer
+value or 0 if the unit is unknown.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#pcdata">pcdata</a>&nbsp;(value)</td>
+ <td class="summary">
+
+Create valid XML PCDATA from given string.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#perror">perror</a>&nbsp;(obj)</td>
+ <td class="summary">
+
+Write given object to stderr.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#restore_data">restore_data</a>&nbsp;(str)</td>
+ <td class="summary">
+
+Restore data previously serialized with serialize_data().</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#serialize_data">serialize_data</a>&nbsp;(val)</td>
+ <td class="summary">
+
+Recursively serialize given data to lua code, suitable for restoring
+with loadstring().</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#serialize_json">serialize_json</a>&nbsp;(data, writer)</td>
+ <td class="summary">
+
+Convert data structure to JSON
+ </td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#shellquote">shellquote</a>&nbsp;(value)</td>
+ <td class="summary">
+
+Safely quote value for use in shell commands.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#spairs">spairs</a>&nbsp;(t, f)</td>
+ <td class="summary">
+
+Return a key, value iterator which returns the values sorted according to
+the provided callback function.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#split">split</a>&nbsp;(str, pat, max, regex)</td>
+ <td class="summary">
+
+Splits given string on a defined separator sequence and return a table
+containing the resulting substrings.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#strip_bytecode">strip_bytecode</a>&nbsp;(code)</td>
+ <td class="summary">
+
+Strips unnecessary lua bytecode from given string.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#striptags">striptags</a>&nbsp;(value)</td>
+ <td class="summary">
+
+Strip HTML tags from given string.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#threadlocal">threadlocal</a>&nbsp;()</td>
+ <td class="summary">
+
+Create a new or get an already existing thread local store associated with
+the current active coroutine.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#trim">trim</a>&nbsp;(str)</td>
+ <td class="summary">
+
+Remove leading and trailing whitespace from given string value.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#ubus">ubus</a>&nbsp;(object, method, values)</td>
+ <td class="summary">
+
+Issue an ubus call.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#update">update</a>&nbsp;(t, updates)</td>
+ <td class="summary">
+
+Update values in given table with the values from the second given table.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#urldecode">urldecode</a>&nbsp;(str, decode_plus)</td>
+ <td class="summary">
+
+Decode an URL-encoded string - optionally decoding the "+" sign to space.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#urlencode">urlencode</a>&nbsp;(str)</td>
+ <td class="summary">
+
+URL-encode given string.</td>
+ </tr>
+
+ <tr>
+ <td class="name" nowrap><a href="#vspairs">vspairs</a>&nbsp;(t)</td>
+ <td class="summary">
+
+Return a key, value iterator for the given table.</td>
+ </tr>
+
+</table>
+
+
+
+
+
+
+<br/>
+<br/>
+
+
+<h2><a name="functions"></a>Functions</h2>
+<dl class="function">
+
+
+
+<dt><a name="append"></a><strong>append</strong>&nbsp;(src, ...)</dt>
+<dd>
+
+
+Appends numerically indexed tables or single objects to a given table.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ src: Target table
+ </li>
+
+ <li>
+ ...: Objects to insert
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Target table
+
+
+
+</dd>
+
+
+
+
+<dt><a name="bigendian"></a><strong>bigendian</strong>&nbsp;()</dt>
+<dd>
+
+
+Test whether the current system is operating in big endian mode.
+
+
+
+
+
+
+
+
+<h3>Return value:</h3>
+Boolean value indicating whether system is big endian
+
+
+
+</dd>
+
+
+
+
+<dt><a name="class"></a><strong>class</strong>&nbsp;(base)</dt>
+<dd>
+
+
+Create a Class object (Python-style object model).
+
+The class object can be instantiated by calling itself.
+Any class functions or shared parameters can be attached to this object.
+Attaching a table to the class object makes this table shared between
+all instances of this class. For object parameters use the __init__ function.
+Classes can inherit member functions and values from a base class.
+Class can be instantiated by calling them. All parameters will be passed
+to the __init__ function of this class - if such a function exists.
+The __init__ function must be used to set any object parameters that are not shared
+with other objects of this class. Any return values will be ignored.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ base: The base class to inherit from (optional)
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+A class object
+
+
+
+<h3>See also:</h3>
+<ul>
+
+ <li><a href="#instanceof">
+ instanceof
+ </a>
+
+ <li><a href="#clone">
+ clone
+ </a>
+
+</ul>
+
+</dd>
+
+
+
+
+<dt><a name="clone"></a><strong>clone</strong>&nbsp;(object, deep)</dt>
+<dd>
+
+
+Clones the given object and return it's copy.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ object: Table value to clone
+ </li>
+
+ <li>
+ deep: Boolean indicating whether to do recursive cloning
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Cloned table value
+
+
+
+</dd>
+
+
+
+
+<dt><a name="cmatch"></a><strong>cmatch</strong>&nbsp;(str, pattern)</dt>
+<dd>
+
+
+Count the occurrences of given substring in given string.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ str: String to search in
+ </li>
+
+ <li>
+ pattern: String containing pattern to find
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Number of found occurrences
+
+
+
+</dd>
+
+
+
+
+<dt><a name="combine"></a><strong>combine</strong>&nbsp;(tbl1, tbl2, ...)</dt>
+<dd>
+
+
+Combines two or more numerically indexed tables and single objects into one table.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ tbl1: Table value to combine
+ </li>
+
+ <li>
+ tbl2: Table value to combine
+ </li>
+
+ <li>
+ ...: More tables to combine
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Table value containing all values of given tables
+
+
+
+</dd>
+
+
+
+
+<dt><a name="contains"></a><strong>contains</strong>&nbsp;(table, value)</dt>
+<dd>
+
+
+Checks whether the given table contains the given value.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ table: Table value
+ </li>
+
+ <li>
+ value: Value to search within the given table
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Number indicating the first index at which the given value occurs
+ within table or false.
+
+
+
+</dd>
+
+
+
+
+<dt><a name="copcall"></a><strong>copcall</strong>&nbsp;(f, ...)</dt>
+<dd>
+
+
+This is a coroutine-safe drop-in replacement for Lua's "pcall"-function
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ f: Lua function to be called protected
+ </li>
+
+ <li>
+ ...: Parameters passed to the function
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+A boolean whether the function call succeeded and the returns
+ values of the function or the error object
+
+
+
+</dd>
+
+
+
+
+<dt><a name="coxpcall"></a><strong>coxpcall</strong>&nbsp;(f, err, ...)</dt>
+<dd>
+
+
+This is a coroutine-safe drop-in replacement for Lua's "xpcall"-function
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ f: Lua function to be called protected
+ </li>
+
+ <li>
+ err: Custom error handler
+ </li>
+
+ <li>
+ ...: Parameters passed to the function
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+A boolean whether the function call succeeded and the return
+ values of either the function or the error handler
+
+
+
+</dd>
+
+
+
+
+<dt><a name="dumptable"></a><strong>dumptable</strong>&nbsp;(t, maxdepth)</dt>
+<dd>
+
+
+Recursively dumps a table to stdout, useful for testing and debugging.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ t: Table value to dump
+ </li>
+
+ <li>
+ maxdepth: Maximum depth
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Always nil
+
+
+
+</dd>
+
+
+
+
+<dt><a name="exec"></a><strong>exec</strong>&nbsp;(command)</dt>
+<dd>
+
+
+Execute given commandline and gather stdout.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ command: String containing command to execute
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+String containing the command's stdout
+
+
+
+</dd>
+
+
+
+
+<dt><a name="execi"></a><strong>execi</strong>&nbsp;(command)</dt>
+<dd>
+
+
+Return a line-buffered iterator over the output of given command.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ command: String containing the command to execute
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Iterator
+
+
+
+</dd>
+
+
+
+
+<dt><a name="get_bytecode"></a><strong>get_bytecode</strong>&nbsp;(val)</dt>
+<dd>
+
+
+Return the current runtime bytecode of the given data. The byte code
+will be stripped before it is returned.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ val: Value to return as bytecode
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+String value containing the bytecode of the given data
+
+
+
+</dd>
+
+
+
+
+<dt><a name="imatch"></a><strong>imatch</strong>&nbsp;(val)</dt>
+<dd>
+
+
+Return a matching iterator for the given value.
+
+The iterator will return one token per invocation, the tokens are separated by
+whitespace. If the input value is a table, it is transformed into a string first.
+A nil value will result in a valid iterator which aborts with the first invocation.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ val: The value to scan (table, string or nil)
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Iterator which returns one token per call
+
+
+
+</dd>
+
+
+
+
+<dt><a name="instanceof"></a><strong>instanceof</strong>&nbsp;(object, class)</dt>
+<dd>
+
+
+Test whether the given object is an instance of the given class.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ object: Object instance
+ </li>
+
+ <li>
+ class: Class object to test against
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Boolean indicating whether the object is an instance
+
+
+
+<h3>See also:</h3>
+<ul>
+
+ <li><a href="#class">
+ class
+ </a>
+
+ <li><a href="#clone">
+ clone
+ </a>
+
+</ul>
+
+</dd>
+
+
+
+
+<dt><a name="keys"></a><strong>keys</strong>&nbsp;(t)</dt>
+<dd>
+
+
+Retrieve all keys of given associative table.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ t: Table to extract keys from
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Sorted table containing the keys
+
+
+
+</dd>
+
+
+
+
+<dt><a name="kspairs"></a><strong>kspairs</strong>&nbsp;(t)</dt>
+<dd>
+
+
+Return a key, value iterator for the given table.
+
+The table pairs are sorted by key.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ t: The table to iterate
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Function value containing the corresponding iterator
+
+
+
+</dd>
+
+
+
+
+<dt><a name="libpath"></a><strong>libpath</strong>&nbsp;()</dt>
+<dd>
+
+
+Returns the absolute path to LuCI base directory.
+
+
+
+
+
+
+
+
+<h3>Return value:</h3>
+String containing the directory path
+
+
+
+</dd>
+
+
+
+
+<dt><a name="parse_units"></a><strong>parse_units</strong>&nbsp;(ustr)</dt>
+<dd>
+
+
+Parse certain units from the given string and return the canonical integer
+value or 0 if the unit is unknown.
+
+Upper- or lower case is irrelevant.
+Recognized units are:
+
+ o "y" - one year (60*60*24*366)
+ o "m" - one month (60*60*24*31)
+ o "w" - one week (60*60*24*7)
+ o "d" - one day (60*60*24)
+ o "h" - one hour (60*60)
+ o "min" - one minute (60)
+ o "kb" - one kilobyte (1024)
+ o "mb" - one megabyte (1024*1024)
+ o "gb" - one gigabyte (1024*1024*1024)
+ o "kib" - one si kilobyte (1000)
+ o "mib" - one si megabyte (1000*1000)
+ o "gib" - one si gigabyte (1000*1000*1000)
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ ustr: String containing a numerical value with trailing unit
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Number containing the canonical value
+
+
+
+</dd>
+
+
+
+
+<dt><a name="pcdata"></a><strong>pcdata</strong>&nbsp;(value)</dt>
+<dd>
+
+
+Create valid XML PCDATA from given string.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ value: String value containing the data to escape
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+String value containing the escaped data
+
+
+
+</dd>
+
+
+
+
+<dt><a name="perror"></a><strong>perror</strong>&nbsp;(obj)</dt>
+<dd>
+
+
+Write given object to stderr.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ obj: Value to write to stderr
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Boolean indicating whether the write operation was successful
+
+
+
+</dd>
+
+
+
+
+<dt><a name="restore_data"></a><strong>restore_data</strong>&nbsp;(str)</dt>
+<dd>
+
+
+Restore data previously serialized with serialize_data().
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ str: String containing the data to restore
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Value containing the restored data structure
+
+
+
+<h3>See also:</h3>
+<ul>
+
+ <li><a href="#serialize_data">
+ serialize_data
+ </a>
+
+ <li><a href="#get_bytecode">
+ get_bytecode
+ </a>
+
+</ul>
+
+</dd>
+
+
+
+
+<dt><a name="serialize_data"></a><strong>serialize_data</strong>&nbsp;(val)</dt>
+<dd>
+
+
+Recursively serialize given data to lua code, suitable for restoring
+with loadstring().
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ val: Value containing the data to serialize
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+String value containing the serialized code
+
+
+
+<h3>See also:</h3>
+<ul>
+
+ <li><a href="#restore_data">
+ restore_data
+ </a>
+
+ <li><a href="#get_bytecode">
+ get_bytecode
+ </a>
+
+</ul>
+
+</dd>
+
+
+
+
+<dt><a name="serialize_json"></a><strong>serialize_json</strong>&nbsp;(data, writer)</dt>
+<dd>
+
+
+Convert data structure to JSON
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ data: The data to serialize
+ </li>
+
+ <li>
+ writer: A function to write a chunk of JSON data (optional)
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+String containing the JSON if called without write callback
+
+
+
+</dd>
+
+
+
+
+<dt><a name="shellquote"></a><strong>shellquote</strong>&nbsp;(value)</dt>
+<dd>
+
+
+Safely quote value for use in shell commands.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ value: String containing the value to quote
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Single-quote enclosed string with embedded quotes escaped
+
+
+
+</dd>
+
+
+
+
+<dt><a name="spairs"></a><strong>spairs</strong>&nbsp;(t, f)</dt>
+<dd>
+
+
+Return a key, value iterator which returns the values sorted according to
+the provided callback function.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ t: The table to iterate
+ </li>
+
+ <li>
+ f: A callback function to decide the order of elements
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Function value containing the corresponding iterator
+
+
+
+</dd>
+
+
+
+
+<dt><a name="split"></a><strong>split</strong>&nbsp;(str, pat, max, regex)</dt>
+<dd>
+
+
+Splits given string on a defined separator sequence and return a table
+containing the resulting substrings.
+
+The optional max parameter specifies the number of bytes to process,
+regardless of the actual length of the given string. The optional last
+parameter, regex, specifies whether the separator sequence is
+nterpreted as regular expression.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ str: String value containing the data to split up
+ </li>
+
+ <li>
+ pat: String with separator pattern (optional, defaults to "\n")
+ </li>
+
+ <li>
+ max: Maximum times to split (optional)
+ </li>
+
+ <li>
+ regex: Boolean indicating whether to interpret the separator
+ pattern as regular expression (optional, default is false)
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Table containing the resulting substrings
+
+
+
+</dd>
+
+
+
+
+<dt><a name="strip_bytecode"></a><strong>strip_bytecode</strong>&nbsp;(code)</dt>
+<dd>
+
+
+Strips unnecessary lua bytecode from given string.
+
+Information like line numbers and debugging numbers will be discarded.
+Original version by Peter Cawley (http://lua-users.org/lists/lua-l/2008-02/msg01158.html)
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ code: String value containing the original lua byte code
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+String value containing the stripped lua byte code
+
+
+
+</dd>
+
+
+
+
+<dt><a name="striptags"></a><strong>striptags</strong>&nbsp;(value)</dt>
+<dd>
+
+
+Strip HTML tags from given string.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ value: String containing the HTML text
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+String with HTML tags stripped of
+
+
+
+</dd>
+
+
+
+
+<dt><a name="threadlocal"></a><strong>threadlocal</strong>&nbsp;()</dt>
+<dd>
+
+
+Create a new or get an already existing thread local store associated with
+the current active coroutine.
+
+A thread local store is private a table object
+whose values can't be accessed from outside of the running coroutine.
+
+
+
+
+
+
+
+
+<h3>Return value:</h3>
+Table value representing the corresponding thread local store
+
+
+
+</dd>
+
+
+
+
+<dt><a name="trim"></a><strong>trim</strong>&nbsp;(str)</dt>
+<dd>
+
+
+Remove leading and trailing whitespace from given string value.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ str: String value containing whitespace padded data
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+String value with leading and trailing space removed
+
+
+
+</dd>
+
+
+
+
+<dt><a name="ubus"></a><strong>ubus</strong>&nbsp;(object, method, values)</dt>
+<dd>
+
+
+Issue an ubus call.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ object: String containing the ubus object to call
+ </li>
+
+ <li>
+ method: String containing the ubus method to call
+ </li>
+
+ <li>
+ values: Table containing the values to pass
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Table containin the ubus result
+
+
+
+</dd>
+
+
+
+
+<dt><a name="update"></a><strong>update</strong>&nbsp;(t, updates)</dt>
+<dd>
+
+
+Update values in given table with the values from the second given table.
+
+Both table are - in fact - merged together.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ t: Table which should be updated
+ </li>
+
+ <li>
+ updates: Table containing the values to update
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Always nil
+
+
+
+</dd>
+
+
+
+
+<dt><a name="urldecode"></a><strong>urldecode</strong>&nbsp;(str, decode_plus)</dt>
+<dd>
+
+
+Decode an URL-encoded string - optionally decoding the "+" sign to space.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ str: Input string in x-www-urlencoded format
+ </li>
+
+ <li>
+ decode_plus: Decode "+" signs to spaces if true (optional)
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+The decoded string
+
+
+
+<h3>See also:</h3>
+<ul>
+
+ <li><a href="#urlencode">
+ urlencode
+ </a>
+
+</ul>
+
+</dd>
+
+
+
+
+<dt><a name="urlencode"></a><strong>urlencode</strong>&nbsp;(str)</dt>
+<dd>
+
+
+URL-encode given string.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ str: String to encode
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+String containing the encoded data
+
+
+
+<h3>See also:</h3>
+<ul>
+
+ <li><a href="#urldecode">
+ urldecode
+ </a>
+
+</ul>
+
+</dd>
+
+
+
+
+<dt><a name="vspairs"></a><strong>vspairs</strong>&nbsp;(t)</dt>
+<dd>
+
+
+Return a key, value iterator for the given table.
+
+The table pairs are sorted by value.
+
+
+
+<h3>Parameters</h3>
+<ul>
+
+ <li>
+ t: The table to iterate
+ </li>
+
+</ul>
+
+
+
+
+
+
+<h3>Return value:</h3>
+Function value containing the corresponding iterator
+
+
+
+</dd>
+
+
+</dl>
+
+
+
+
+
+</div> <!-- id="content" -->
+
+</div> <!-- id="main" -->
+
+<div id="about">
+ <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>
+</div> <!-- id="about" -->
+
+</div> <!-- id="container" -->
+</body>
+</html>