Mercurial Hosting > luan
diff website/src/manual.html.luan @ 685:1e4b0bc0202d
update documentation
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 16 Apr 2016 22:37:47 -0600 |
parents | c4216a583de4 |
children | ca169567ce07 |
line wrap: on
line diff
--- a/website/src/manual.html.luan Sat Apr 16 21:42:19 2016 -0600 +++ b/website/src/manual.html.luan Sat Apr 16 22:37:47 2016 -0600 @@ -472,16 +472,6 @@ to do the assignment.) </li> -<li><p><b>"call": </b> -The call operation <code>func(args)</code>. - -This event happens when Luan tries to call a table. -The metamethod is looked up in <code>func</code>. -If present, -the metamethod is called with <code>func</code> as its first argument, -followed by the arguments of the original call (<code>args</code>). -</li> - </ul> @@ -526,7 +516,7 @@ Luan ignores spaces and comments between lexical elements (tokens), except as delimiters between names and keywords. -Luan generally considers the end of a line to be the end of a statement. This catches errors and encourages readability. The exception to this is in paranthesis <em>(...)</em> where the end of line is treated as white space. +Luan considers the end of a line to be the end of a statement. This catches errors and encourages readability. If you want to continue a statement on another line, you can use a backslash followed by a newline which will be treated as white space. <p> <em>Names</em> @@ -1493,13 +1483,9 @@ <p> In a function call, first prefixexp and args are evaluated. -If the value of prefixexp has type <em>function</em>, -then this function is called +The value of prefixexp must have type <em>function</em>. +This function is called with the given arguments. -Otherwise, the prefixexp "call" metamethod is called, -having as first parameter the value of prefixexp, -followed by the original call arguments -(see <a href="#meta">Metatables and Metamethods</a>). <p> @@ -1522,32 +1508,6 @@ that is, the argument list is a single literal string. -<p> -A call of the form <code>return <em>functioncall</em></code> is called -a <em>tail call</em>. -Luan implements <em>proper tail calls</em> -(or <em>proper tail recursion</em>): -in a tail call, -the called function reuses the stack entry of the calling function. -Therefore, there is no limit on the number of nested tail calls that -a program can execute. -However, a tail call erases any debug information about the -calling function. -Note that a tail call only happens with a particular syntax, -where the <b>return</b> has one single function call as argument; -this syntax makes the calling function return exactly -the returns of the called function. -So, none of the following examples are tail calls: - -<pre> - return (f(x)) -- results adjusted to 1 - return 2 * f(x) - return x, f(x) -- additional results - f(x); return -- results discarded - return x or f(x) -- results adjusted to 1 -</pre> - - <h4 heading><a name="fn_def">Function Definitions</a></h4>