diff website/src/manual.html.luan @ 475:7ac0891718eb

documentation
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 10 May 2015 20:44:55 -0600
parents 00646edc9d92
children cd22e4694ea3
line wrap: on
line diff
--- a/website/src/manual.html.luan	Sun May 10 16:09:45 2015 -0600
+++ b/website/src/manual.html.luan	Sun May 10 20:44:55 2015 -0600
@@ -2034,50 +2034,41 @@
 
 
 
-
-<p>
-<hr><h3><a name="pdf-pairs"><code>pairs (t)</code></a></h3>
-
-
-<p>
-If <code>t</code> has a metamethod <code>__pairs</code>,
-calls it with <code>t</code> as argument and returns the first three
-results from the call.
+<h4 margin-top="1em"><a name="Luan.pairs"><tt>Luan.pairs (t)</tt></a></h4>
+
+<p>
+If <tt>t</tt> has a metamethod <tt>__pairs</tt>,
+calls it with <tt>t</tt> as argument and returns the
+result from the call.
 
 
 <p>
 Otherwise,
-returns three values: the <a href="#pdf-next"><code>next</code></a> function, the table <code>t</code>, and <b>nil</b>,
+returns a function
 so that the construction
 
-<pre>
-     for k,v in pairs(t) do <em>body</em> end
-</pre><p>
-will iterate over all key&ndash;value pairs of table <code>t</code>.
-
-
-<p>
-See function <a href="#pdf-next"><code>next</code></a> for the caveats of modifying
-the table during its traversal.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-pcall"><code>pcall (f [, arg1, &middot;&middot;&middot;])</code></a></h3>
-
-
-<p>
-Calls function <code>f</code> with
-the given arguments in <em>protected mode</em>.
-This means that any error inside&nbsp;<code>f</code> is not propagated;
-instead, <code>pcall</code> catches the error
+<p><tt><pre>
+	for k,v in pairs(t) do <i>body</i> end
+</pre></tt></p>
+
+<p>
+will iterate over all key&ndash;value pairs of table <tt>t</tt>.
+
+
+
+<h4 margin-top="1em"><a name="Luan.pcall"><tt>Luan.pcall (f [, arg1, &middot;&middot;&middot;])</tt></a></h4>
+
+<p>
+Calls function <tt>f</tt> with
+the given arguments in <i>protected mode</i>.
+This means that any error inside&nbsp;<tt>f</tt> is not propagated;
+instead, <tt>pcall</tt> catches the error
 and returns a status code.
 Its first result is the status code (a boolean),
 which is true if the call succeeds without errors.
-In such case, <code>pcall</code> also returns all results from the call,
+In such case, <tt>pcall</tt> also returns all results from the call,
 after this first result.
-In case of any error, <code>pcall</code> returns <b>false</b> plus the error message.
+In case of any error, <tt>pcall</tt> returns <b>false</b> plus the error.
 
 
 
@@ -2096,46 +2087,47 @@
 
 
 
-<p>
-<hr><h3><a name="pdf-rawequal"><code>rawequal (v1, v2)</code></a></h3>
-Checks whether <code>v1</code> is equal to <code>v2</code>,
+<h4 margin-top="1em"><a name="Luan.raw_equal"><tt>Luan.raw_equal (v1, v2)</tt></a></h4>
+
+<p>
+Checks whether <tt>v1</tt> is equal to <tt>v2</tt>,
 without invoking any metamethod.
 Returns a boolean.
 
 
 
-
-<p>
-<hr><h3><a name="pdf-rawget"><code>rawget (table, index)</code></a></h3>
-Gets the real value of <code>table[index]</code>,
+<h4 margin-top="1em"><a name="Luan.raw_get"><tt>Luan.raw_get (table, index)</tt></a></h4>
+
+<p>
+Gets the real value of <tt>table[index]</tt>,
 without invoking any metamethod.
-<code>table</code> must be a table;
-<code>index</code> may be any value.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-rawlen"><code>rawlen (v)</code></a></h3>
-Returns the length of the object <code>v</code>,
+<tt>table</tt> must be a table;
+<tt>index</tt> may be any value.
+
+
+
+<h4 margin-top="1em"><a name="Luan.raw_len"><tt>Luan.raw_len (v)</tt></a></h4>
+
+<p>
+Returns the length of the object <tt>v</tt>,
 which must be a table or a string,
 without invoking any metamethod.
 Returns an integer.
 
 
 
-
-<p>
-<hr><h3><a name="pdf-rawset"><code>rawset (table, index, value)</code></a></h3>
-Sets the real value of <code>table[index]</code> to <code>value</code>,
+<h4 margin-top="1em"><a name="Luan.raw_set"><tt>Luan.raw_set (table, index, value)</tt></a></h4>
+
+<p>
+Sets the real value of <tt>table[index]</tt> to <tt>value</tt>,
 without invoking any metamethod.
-<code>table</code> must be a table,
-<code>index</code> any value different from <b>nil</b> and NaN,
-and <code>value</code> any Lua value.
-
-
-<p>
-This function returns <code>table</code>.
+<tt>table</tt> must be a table,
+<tt>index</tt> any value different from <b>nil</b>,
+and <tt>value</tt> any Lua value.
+
+
+<p>
+This function returns <tt>table</tt>.
 
 
 
@@ -2154,21 +2146,18 @@
 
 
 
-<p>
-<hr><h3><a name="pdf-setmetatable"><code>setmetatable (table, metatable)</code></a></h3>
-
+<h4 margin-top="1em"><a name="Luan.set_metatable"><tt>Luan.set_metatable (table, metatable)</tt></a></h4>
 
 <p>
 Sets the metatable for the given table.
-(You cannot change the metatable of other types from Lua, only from&nbsp;C.)
-If <code>metatable</code> is <b>nil</b>,
+If <tt>metatable</tt> is <b>nil</b>,
 removes the metatable of the given table.
-If the original metatable has a <code>"__metatable"</code> field,
+If the original metatable has a <tt>"__metatable"</tt> field,
 raises an error.
 
 
 <p>
-This function returns <code>table</code>.
+This function returns <tt>table</tt>.
 
 
 
@@ -2206,180 +2195,42 @@
 
 
 
-<p>
-<hr><h3><a name="pdf-tostring"><code>tostring (v)</code></a></h3>
+<h4 margin-top="1em"><a name="Luan.to_string"><tt>Luan.to_string (v)</tt></a></h4>
+
+<p>
 Receives a value of any type and
 converts it to a string in a human-readable format.
-Floats always produce strings with some
-floating-point indication (either a decimal dot or an exponent).
-(For complete control of how numbers are converted,
-use <a href="#pdf-string.format"><code>string.format</code></a>.)
-
-
-<p>
-If the metatable of <code>v</code> has a <code>"__to_string"</code> field,
-then <code>tostring</code> calls the corresponding value
-with <code>v</code> as argument,
+
+<p>
+If the metatable of <tt>v</tt> has a <tt>"__to_string"</tt> field,
+then <tt>to_string</tt> calls the corresponding value
+with <tt>v</tt> as argument,
 and uses the result of the call as its result.
 
 
 
-
-<p>
-<hr><h3><a name="pdf-type"><code>type (v)</code></a></h3>
+<h4 margin-top="1em"><a name="Luan.type"><tt>Luan.type (v)</tt></a></h4>
+
+<p>
 Returns the type of its only argument, coded as a string.
 The possible results of this function are
-"<code>nil</code>" (a string, not the value <b>nil</b>),
-"<code>number</code>",
-"<code>string</code>",
-"<code>boolean</code>",
-"<code>table</code>",
-"<code>function</code>",
-"<code>thread</code>",
-and "<code>userdata</code>".
-
-
-
-
-<p>
-<hr><h3><a name="pdf-_VERSION"><code>_VERSION</code></a></h3>
+"<tt>nil</tt>" (a string, not the value <b>nil</b>),
+"<tt>number</tt>",
+"<tt>string</tt>",
+"<tt>binary</tt>",
+"<tt>boolean</tt>",
+"<tt>table</tt>",
+"<tt>function</tt>",
+and "<tt>userdata</tt>".
+
+
+
+<h4 margin-top="1em"><a name="Luan.VERSION"><tt>Luan.VERSION</tt></a></h4>
+
+<p>
 A global variable (not a function) that
 holds a string containing the current interpreter version.
-The current value of this variable is "<code>Lua 5.3</code>".
-
-
-
-
-<p>
-<hr><h3><a name="pdf-xpcall"><code>xpcall (f, msgh [, arg1, &middot;&middot;&middot;])</code></a></h3>
-
-
-<p>
-This function is similar to <a href="#pdf-pcall"><code>pcall</code></a>,
-except that it sets a new message handler <code>msgh</code>.
-
-
-
-
-
-
-
-<h2>6.2 &ndash; <a name="6.2">Coroutine Manipulation</a></h2>
-
-<p>
-The operations related to coroutines comprise a sub-library of
-the basic library and come inside the table <a name="pdf-coroutine"><code>coroutine</code></a>.
-See <a href="#2.6">&sect;2.6</a> for a general description of coroutines.
-
-
-<p>
-<hr><h3><a name="pdf-coroutine.create"><code>coroutine.create (f)</code></a></h3>
-
-
-<p>
-Creates a new coroutine, with body <code>f</code>.
-<code>f</code> must be a Lua function.
-Returns this new coroutine,
-an object with type <code>"thread"</code>.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-coroutine.isyieldable"><code>coroutine.isyieldable ()</code></a></h3>
-
-
-<p>
-Returns true when the running coroutine can yield.
-
-
-<p>
-A running coroutine is yieldable if it is not the main thread and
-it is not inside a non-yieldable C function.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-coroutine.resume"><code>coroutine.resume (co [, val1, &middot;&middot;&middot;])</code></a></h3>
-
-
-<p>
-Starts or continues the execution of coroutine <code>co</code>.
-The first time you resume a coroutine,
-it starts running its body.
-The values <code>val1</code>, ... are passed
-as the arguments to the body function.
-If the coroutine has yielded,
-<code>resume</code> restarts it;
-the values <code>val1</code>, ... are passed
-as the results from the yield.
-
-
-<p>
-If the coroutine runs without any errors,
-<code>resume</code> returns <b>true</b> plus any values passed to <code>yield</code>
-(when the coroutine yields) or any values returned by the body function
-(when the coroutine terminates).
-If there is any error,
-<code>resume</code> returns <b>false</b> plus the error message.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-coroutine.running"><code>coroutine.running ()</code></a></h3>
-
-
-<p>
-Returns the running coroutine plus a boolean,
-true when the running coroutine is the main one.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-coroutine.status"><code>coroutine.status (co)</code></a></h3>
-
-
-<p>
-Returns the status of coroutine <code>co</code>, as a string:
-<code>"running"</code>,
-if the coroutine is running (that is, it called <code>status</code>);
-<code>"suspended"</code>, if the coroutine is suspended in a call to <code>yield</code>,
-or if it has not started running yet;
-<code>"normal"</code> if the coroutine is active but not running
-(that is, it has resumed another coroutine);
-and <code>"dead"</code> if the coroutine has finished its body function,
-or if it has stopped with an error.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-coroutine.wrap"><code>coroutine.wrap (f)</code></a></h3>
-
-
-<p>
-Creates a new coroutine, with body <code>f</code>.
-<code>f</code> must be a Lua function.
-Returns a function that resumes the coroutine each time it is called.
-Any arguments passed to the function behave as the
-extra arguments to <code>resume</code>.
-Returns the same values returned by <code>resume</code>,
-except the first boolean.
-In case of error, propagates the error.
-
-
-
-
-<p>
-<hr><h3><a name="pdf-coroutine.yield"><code>coroutine.yield (&middot;&middot;&middot;)</code></a></h3>
-
-
-<p>
-Suspends the execution of the calling coroutine.
-Any arguments to <code>yield</code> are passed as extra results to <code>resume</code>.
+The current value of this variable is "<tt>Luan 0.8</tt>".