Mercurial Hosting > luan
diff website/src/diff.html.luan @ 465:47c7de1f2322
documentation work
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 07 May 2015 22:10:45 -0600 |
parents | eddf7c73373b |
children | 9b51e2413cab |
line wrap: on
line diff
--- a/website/src/diff.html.luan Thu May 07 21:31:19 2015 -0600 +++ b/website/src/diff.html.luan Thu May 07 22:10:45 2015 -0600 @@ -48,16 +48,18 @@ <li><a href="#control">Control Structures</a></li> <li><a href="#for">For Statement</a></li> <li><a href="#logical">Logical Statements</a></li> - <li><a href="#template-stmt">Template Statements</a></li> + <li><a href="#template_stmt">Template Statements</a></li> </ul> </li> <li> <a href="#expr">Expressions</a> <ul> + <li><a href="#conversions">Coercions and Conversions</a></li> <li><a href="#bit">Bitwise Operators</a></li> - <li><a href="#local-ops">Logical Operators</a></li> - <li><a href="#fn-call">Function Calls</a></li> - <li><a href="#template-expr">Template Expressions</a></li> + <li><a href="#logical_ops">Logical Operators</a></li> + <li><a href="#concatenation">Concatenation</a></li> + <li><a href="#fn_calls">Function Calls</a></li> + <li><a href="#template_expr">Template Expressions</a></li> </ul> </li> </ul> @@ -99,7 +101,7 @@ <h3 margin-top="1em"><a name="meta">Metatables and Metamethods</a></h3> -<p>to document later...</p> +<p>Luan only has metatable for tables, not for other types.</p> <h3 margin-top="1em"><a name="gc">Garbage Collection</a></h3> @@ -164,59 +166,36 @@ x==5 or error "x should be 5" </pre></tt></p> -<h4 margin-top="1em"><a name="template-stmt">Template Statements</a></h4> - -<p>Template statements are based on <a href="#template-expr">template exressions</a> and provide the full equivalent of <a href="http://en.wikipedia.org/wiki/JavaServer_Pages">JSP</a> but in a general way. Template statements write the equivalent template exression to standard output. For example:</p> +<h4 margin-top="1em"><a name="template_stmt">Template Statements</a></h4> -<p><tt><pre><%=Html.encode[[ - local name = "Bob" - %> - Hello <%=name%>! - Bye <%=name%>. - <% -]]%></pre></tt></p> +<p>Template statements are a Luan addition that don't exist in Lua. See <a href="manual.html#template_stmt">Template Statements</a> in the Luan Reference Manual.</p> -<p>is equivalent to the code:</p> - -<p><tt><pre><%=Html.encode[[ - local name = "Bob" - require("luan:Io").stdout.write( %> - Hello <%=name%>! - Bye <%=name%>. - <% ) -]]%></pre></tt></p> <h3 margin-top="1em"><a name="expr">Expressions</a></h3> +<h4 margin-top="1em"><a name="conversions">Coercions and Conversions</a></h4> + +<p>Unlike Lua, Luan does not do automatic conversions of strings to numbers.</p> + <h4 margin-top="1em"><a name="bit">Bitwise Operators</a></h4> -<p>Bitwise operators appear to be new addition to Lua 5.3 and didn't exist in Lua 5.2. Luan does not support bitwise operators, but these can be added if there is a need.</p> +<p>Bitwise operators appear to be a new addition to Lua 5.3 and didn't exist in Lua 5.2. Luan does not support bitwise operators, but these can be added if there is a need.</p> -<h4 margin-top="1em"><a name="local-ops">Logical Operators</a></h4> +<h4 margin-top="1em"><a name="logical_ops">Logical Operators</a></h4> <p>The only change in Luan is that <b>not</b> must take a boolean argument. This helps catch errors and makes code more readable.</p> -<h4 margin-top="1em"><a name="fn-call">Function Calls</a></h4> +<h4 margin-top="1em"><a name="concatenation">Concatenation</a></h4> + +<p>Unlike Lua, Luan converts all concatenation operands to strings. + +<h4 margin-top="1em"><a name="fn_calls">Function Calls</a></h4> <p>Luan does not support Lua's <tt>v:name(args)</tt> style object-oriented function call. Object oriented programming is done in Luan using closures, so this feature is not needed.</p> -<h4 margin-top="1em"><a name="template-expr">Template Expressions</a></h4> - -<p>Luan adds a new type of expression based on <a href="http://en.wikipedia.org/wiki/JavaServer_Pages">JSP</a> called template expressions. Template expressions return multiple values. Here is an example:</p> - -<p><tt><pre><%=Html.encode[[ - local name = "Bob" - write( %>Hello <%=name%>!<% ) -]]%></pre></tt></p> +<h4 margin-top="1em"><a name="template_expr">Template Expressions</a></h4> -<p>This is equivalent to the code:</p> - -<p><tt><pre> - local name = "Bob" - write( "Hello ", name, "!" ) -</pre></tt></p> - -<p>The strings in template expressions may be multiple lines.</p> +<p>Template expressions are a Luan addition that don't exist in Lua. See <a href="manual.html#template_expr">Template Expressions</a> in the Luan Reference Manual.</p> </div>