diff website/src/manual.html.luan @ 565:22bfd8a2eaee

do Table documentation; replace Table.clone and Table.sub_list with Table.copy;
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 05 Jul 2015 00:47:00 -0600
parents 7cc9d4a53d3b
children 90b93790c544
line wrap: on
line diff
--- a/website/src/manual.html.luan	Sat Jul 04 20:57:24 2015 -0600
+++ b/website/src/manual.html.luan	Sun Jul 05 00:47:00 2015 -0600
@@ -91,6 +91,7 @@
 		<li><a href="#luan_lib">Basic Functions</a></li>
 		<li><a href="#package_lib">Modules</a></li>
 		<li><a href="#string_lib">String Manipulation</a></li>
+		<li><a href="#table_lib">Table Manipulation</a></li>
 	</ul>
 </div>
 
@@ -2657,27 +2658,25 @@
 
 
 
-<h2>6.6 &ndash; <a name="6.6">Table Manipulation</a></h2>
+<h3 heading><a name="table_lib">Table Manipulation</a></h3>
+
+<p>
+Include this library by:
+
+<pre>
+	local Table = require "luan:Table"
+</pre>
 
 <p>
 This library provides generic functions for table manipulation.
-It provides all its functions inside the table <a name="pdf-table"><code>table</code></a>.
-
-
-<p>
-Remember that, whenever an operation needs the length of a table,
-the table must be a proper sequence
-or have a <code>__len</code> metamethod (see <a href="#3.4.7">&sect;3.4.7</a>).
-All functions ignore non-numeric keys
-in the tables given as arguments.
-
-
-<p>
-<hr><h3><a name="pdf-table.concat"><code>table.concat (list [, sep [, i [, j]]])</code></a></h3>
-
-
-<p>
-Given a list where all elements are strings or numbers,
+It provides all its functions inside the table <code>Table</code>.
+
+
+
+<h4 heading><a name="Table.concat"><code>Table.concat (list [, sep [, i [, j]]])</code></a></h4>
+
+<p>
+Given a list,
 returns the string <code>list[i]..sep..list[i+1] &middot;&middot;&middot; sep..list[j]</code>.
 The default value for <code>sep</code> is the empty string,
 the default for <code>i</code> is 1,
@@ -2685,42 +2684,25 @@
 If <code>i</code> is greater than <code>j</code>, returns the empty string.
 
 
-
-
-<p>
-<hr><h3><a name="pdf-table.insert"><code>table.insert (list, [pos,] value)</code></a></h3>
-
+<h4 heading><a name="Table.copy"><code>Table.copy (tbl [, i [, j]])</code></a></h4>
+
+<p>
+If <code>i</code> is <code>nil</code>, returns a shallow copy of <code>tbl</code>.
+Otherwise returns a new table which is a list of the elements <code>tbl[i] &middot;&middot;&middot; tbl[j]</code>.
+By default, <code>j</code> is <code>#tbl</code>.
+
+
+
+<h4 heading><a name="Table.insert"><code>Table.insert (list, pos, value)</code></a></h4>
 
 <p>
 Inserts element <code>value</code> at position <code>pos</code> in <code>list</code>,
 shifting up the elements
 <code>list[pos], list[pos+1], &middot;&middot;&middot;, list[#list]</code>.
-The default value for <code>pos</code> is <code>#list+1</code>,
-so that a call <code>table.insert(t,x)</code> inserts <code>x</code> at the end
-of list <code>t</code>.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-table.move"><code>table.move (a1, f, e, t [,a2])</code></a></h3>
-
-
-<p>
-Moves elements from table <code>a1</code> to table <code>a2</code>.
-This function performs the equivalent to the following
-multiple assignment:
-<code>a2[t],&middot;&middot;&middot; = a1[f],&middot;&middot;&middot;,a1[e]</code>.
-The default for <code>a2</code> is <code>a1</code>.
-The destination range can overlap with the source range.
-Index <code>f</code> must be positive.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-table.pack"><code>table.pack (&middot;&middot;&middot;)</code></a></h3>
-
+
+
+
+<h4 heading><a name="Table.pack"><code>Table.pack (&middot;&middot;&middot;)</code></a></h4>
 
 <p>
 Returns a new table with all parameters stored into keys 1, 2, etc.
@@ -2730,8 +2712,7 @@
 
 
 
-<p>
-<hr><h3><a name="pdf-table.remove"><code>table.remove (list [, pos])</code></a></h3>
+<h4 heading><a name="Table.remove"><code>Table.remove (list, pos)</code></a></h4>
 
 
 <p>
@@ -2746,17 +2727,9 @@
 in those cases, the function erases the element <code>list[pos]</code>.
 
 
-<p>
-The default value for <code>pos</code> is <code>#list</code>,
-so that a call <code>table.remove(l)</code> removes the last element
-of list <code>l</code>.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-table.sort"><code>table.sort (list [, comp])</code></a></h3>
-
+
+
+<h4 heading><a name="Table.sort"><code>Table.sort (list [, comp])</code></a></h4>
 
 <p>
 Sorts list elements in a given order, <em>in-place</em>,
@@ -2769,7 +2742,6 @@
 If <code>comp</code> is not given,
 then the standard Lua operator <code>&lt;</code> is used instead.
 
-
 <p>
 The sort algorithm is not stable;
 that is, elements considered equal by the given order
@@ -2777,10 +2749,7 @@
 
 
 
-
-<p>
-<hr><h3><a name="pdf-table.unpack"><code>table.unpack (list [, i [, j]])</code></a></h3>
-
+<h4 heading><a name="Table.unpack"><code>Table.unpack (list [, i [, j]])</code></a></h4>
 
 <p>
 Returns the elements from the given list.
@@ -2788,7 +2757,9 @@
 
 <pre>
      return list[i], list[i+1], &middot;&middot;&middot;, list[j]
-</pre><p>
+</pre>
+
+<p>
 By default, <code>i</code> is&nbsp;1 and <code>j</code> is <code>#list</code>.