Mercurial Hosting > luan
diff website/src/manual.html.luan @ 502:d3183a330ff5
improve the __index metamethod to work with any type;
simplify luan_proxy to eliminate base;
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 19 May 2015 17:57:20 -0600 |
parents | 598123096772 |
children | 92c3d22745b8 |
line wrap: on
line diff
--- a/website/src/manual.html.luan Mon May 18 23:23:01 2015 -0600 +++ b/website/src/manual.html.luan Tue May 19 17:57:20 2015 -0600 @@ -343,7 +343,7 @@ <ul> -<li><b>"add": </b> +<li><p><b>"add": </b> the <tt>+</tt> operation. If any operand for an addition is a table, @@ -360,49 +360,49 @@ it raises an error. </li> -<li><b>"sub": </b> +<li><p><b>"sub": </b> the <tt>-</tt> operation. Behavior similar to the "add" operation. </li> -<li><b>"mul": </b> +<li><p><b>"mul": </b> the <tt>*</tt> operation. Behavior similar to the "add" operation. </li> -<li><b>"div": </b> +<li><p><b>"div": </b> the <tt>/</tt> operation. Behavior similar to the "add" operation. </li> -<li><b>"mod": </b> +<li><p><b>"mod": </b> the <tt>%</tt> operation. Behavior similar to the "add" operation. </li> -<li><b>"pow": </b> +<li><p><b>"pow": </b> the <tt>^</tt> (exponentiation) operation. Behavior similar to the "add" operation. </li> -<li><b>"unm": </b> +<li><p><b>"unm": </b> the <tt>-</tt> (unary minus) operation. Behavior similar to the "add" operation. </li> -<li><b>"concat": </b> +<li><p><b>"concat": </b> the <tt>..</tt> (concatenation) operation. Behavior similar to the "add" operation. </li> -<li><b>"len": </b> +<li><p><b>"len": </b> the <tt>#</tt> (length) operation. If there is a metamethod, @@ -415,7 +415,7 @@ Otherwise, Luan raises an error. </li> -<li><b>"eq": </b> +<li><p><b>"eq": </b> the <tt>==</tt> (equal) operation. Behavior similar to the "add" operation, @@ -425,14 +425,14 @@ The result of the call is always converted to a boolean. </li> -<li><b>"lt": </b> +<li><p><b>"lt": </b> the <tt><</tt> (less than) operation. Behavior similar to the "add" operation. The result of the call is always converted to a boolean. </li> -<li><b>"le": </b> +<li><p><b>"le": </b> the <tt><=</tt> (less equal) operation. Unlike other operations, @@ -446,7 +446,7 @@ the result is always a boolean. </li> -<li><b>"index": </b> +<li><p><b>"index": </b> The indexing access <tt>table[key]</tt>. This event happens @@ -456,16 +456,16 @@ <p> Despite the name, -the metamethod for this event can be either a function or a table. +the metamethod for this event can be any type. If it is a function, it is called with <tt>table</tt> and <tt>key</tt> as arguments. -If it is a table, -the final result is the result of indexing this table with <tt>key</tt>. +Otherwise +the final result is the result of indexing this metamethod object with <tt>key</tt>. (This indexing is regular, not raw, -and therefore can trigger another metamethod.) +and therefore can trigger another metamethod if the metamethod object is a table.) </li> -<li><b>"new_index": </b> +<li><p><b>"new_index": </b> The indexing assignment <tt>table[key] = value</tt>. Like the index event, @@ -493,7 +493,7 @@ to do the assignment.) </li> -<li><b>"call": </b> +<li><p><b>"call": </b> The call operation <tt>func(args)</tt>. This event happens when Luan tries to call a table.