comparison website/src/diff.html @ 367:c207be7cf45d

more documentation
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 16 Apr 2015 18:44:55 -0600
parents 705e4d6c3dbb
children 7999601586b1
comparison
equal deleted inserted replaced
366:82ba0a82cd00 367:c207be7cf45d
43 <a href="#stmt">Statements</a> 43 <a href="#stmt">Statements</a>
44 <ul> 44 <ul>
45 <li><a href="#control">Control Structures</a></li> 45 <li><a href="#control">Control Structures</a></li>
46 <li><a href="#for">For Statement</a></li> 46 <li><a href="#for">For Statement</a></li>
47 <li><a href="#logical">Logical Statements</a></li> 47 <li><a href="#logical">Logical Statements</a></li>
48 <li><a href="#template-stmt">Template Statements</a></li>
49 </ul>
50 </li>
51 <li>
52 <a href="#expr">Expressions</a>
53 <ul>
54 <li><a href="#bit">Bitwise Operators</a></li>
55 <li><a href="#local-ops">Logical Operators</a></li>
56 <li><a href="#fn-call">Function Calls</a></li>
57 <li><a href="#template-expr">Template Expressions</a></li>
48 </ul> 58 </ul>
49 </li> 59 </li>
50 </ul> 60 </ul>
51 </div> 61 </div>
52 62
147 157
148 <tt><pre> 158 <tt><pre>
149 x==5 or error "x should be 5" 159 x==5 or error "x should be 5"
150 </pre></tt> 160 </pre></tt>
151 161
162 <h4 margin-top="1em"><a name="template-stmt">Template Statements</a></h4>
163
164 <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>
165
166 <tt><pre>
167 local name = "Bob"
168 %>
169 Hello <%=name%>!
170 Bye <%=name%>.
171 <%
172 </pre></tt>
173
174 <p>is equivalent to the code:</p>
175
176 <tt><pre>
177 local name = "Bob"
178 Io.stdout.write( %>
179 Hello <%=name%>!
180 Bye <%=name%>.
181 <% )
182 </pre></tt>
183
184 <h3 margin-top="1em"><a name="expr">Expressions</a></h3>
185
186 <h4 margin-top="1em"><a name="bit">Bitwise Operators</a></h4>
187
188 <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>
189
190 <h4 margin-top="1em"><a name="local-ops">Logical Operators</a></h4>
191
192 <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>
193
194 <h4 margin-top="1em"><a name="fn-call">Function Calls</a></h4>
195
196 <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>
197
198 <h4 margin-top="1em"><a name="template-expr">Template Expressions</a></h4>
199
200 <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>
201
202 <tt><pre>
203 local name = "Bob"
204 write( %>Hello <%=name%>!<% )
205 </pre></tt>
206
207 <p>This template expression returns 3 values: "Hello ", "Bob", and "!". The strings in template expressions may be multiple lines.</p>
208
152 </div> 209 </div>
153 210
154 <script src="http://www.simplyhtml.org/assets/bootstrap/js/bootstrap.min.js"></script> 211 <script src="http://www.simplyhtml.org/assets/bootstrap/js/bootstrap.min.js"></script>
155 </body> 212 </body>
156 </html> 213 </html>