Mercurial Hosting > luan
diff website/src/diff.html @ 1520:d9a5405a3102
try statement
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 21 Jun 2020 18:14:13 -0600 |
parents | f5368cd8c056 |
children | d3e61cd2aca0 |
line wrap: on
line diff
--- a/website/src/diff.html Fri Jun 19 20:10:47 2020 -0600 +++ b/website/src/diff.html Sun Jun 21 18:14:13 2020 -0600 @@ -45,6 +45,7 @@ <ul> <li><a href="#control">Control Structures</a></li> <li><a href="#for">For Statement</a></li> + <li><a href="#try">Try Statement</a></li> <li><a href="#logical">Logical Statements</a></li> <li><a href="#template_stmt">Template Statements</a></li> </ul> @@ -95,7 +96,7 @@ <h3 heading><a name="error" href="#error">Error Handling</a></h3> -<p>Luan has the functions <code>error</code> and <code>pcall</code> but does not have <code>xpcall</code>. Luan adds the function <code>try</code> which looks and acts like try-catch blocks in other languages. Luan errors are implemented as an error table, not as a message object.</p> +<p>Luan has the functions <code>error</code> but does not have <code>pcall</code> or <code>xpcall</code>. Luan adds the <a href="#try">try statement</a> instead. Luan errors are implemented as an error table, not as a message object.</p> <h3 heading><a name="meta" href="#meta">Metatables and Metamethods</a></h3> @@ -165,6 +166,11 @@ end </pre> + +<h4 heading><a name="try" href="#for">Try Statement</a></h4> + +<p>Unlike Lua, Luan has a <b>try</b> statement. See <a href="manual.html#try">Try Statement</a> in the Luan Reference Manual. This also eliminates the need for Lua's <b>pcall</b> function which Luan doesn't have.</p> + <h4 heading><a name="logical" href="#logical">Logical Statements</a></h4> <p>Unlike Lua, Luan allows <b>or</b> and <b>and</b> expressions to be stand-alone statements. This is useful in cases like this:</p>