changeset 367:c207be7cf45d

more documentation
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 16 Apr 2015 18:44:55 -0600
parents 82ba0a82cd00
children 2af805677fc4
files website/src/diff.html
diffstat 1 files changed, 57 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/website/src/diff.html	Thu Apr 16 11:57:47 2015 -0600
+++ b/website/src/diff.html	Thu Apr 16 18:44:55 2015 -0600
@@ -45,6 +45,16 @@
 							<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>
+						</ul>
+					</li>
+					<li>
+						<a href="#expr">Expressions</a>
+						<ul>
+							<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>
 						</ul>
 					</li>
 				</ul>
@@ -149,6 +159,53 @@
 	x==5 or error "x should be 5"
 			</pre></tt>
 
+			<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>
+
+			<tt><pre>
+	local name = "Bob"
+	%>
+	Hello <%=name%>!
+	Bye <%=name%>.
+	<%
+			</pre></tt>
+
+			<p>is equivalent to the code:</p>
+
+			<tt><pre>
+	local name = "Bob"
+	Io.stdout.write( %>
+	Hello <%=name%>!
+	Bye <%=name%>.
+	<% )
+			</pre></tt>
+
+			<h3 margin-top="1em"><a name="expr">Expressions</a></h3>
+
+			<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>
+
+			<h4 margin-top="1em"><a name="local-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>
+
+			<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>
+
+			<tt><pre>
+	local name = "Bob"
+	write( %>Hello <%=name%>!<% )
+			</pre></tt>
+
+			<p>This template expression returns 3 values: "Hello ", "Bob", and "!".  The strings in template expressions may be multiple lines.</p>
+
 		</div>
 		
 		<script src="http://www.simplyhtml.org/assets/bootstrap/js/bootstrap.min.js"></script>