Mercurial Hosting > luan
diff website/src/manual.html @ 382:8557581740db
added tutorial
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 22 Apr 2015 20:38:48 -0600 |
parents | 6c6c3537035e |
children |
line wrap: on
line diff
--- a/website/src/manual.html Wed Apr 22 13:17:35 2015 -0600 +++ b/website/src/manual.html Wed Apr 22 20:38:48 2015 -0600 @@ -299,10 +299,9 @@ You can emulate how Luan queries a metamethod for an object <tt>obj</tt> with the following code: -<tt><pre> +<p><tt><pre> raw_get(get_metatable(obj) or {}, "__" .. event_name) - -</pre></tt> +</pre></tt></p> <p> Here are the events: @@ -529,12 +528,12 @@ and cannot be used as names: -<pre> +<p><pre> and break do else elseif end false for function goto if in local nil not or repeat return then true until while -</pre> +</pre></p> <p> Luan is a case-sensitive language: @@ -545,14 +544,13 @@ <p> The following strings denote other tokens: -<pre> +<p><pre> + - * / % ^ # & ~ | << >> // == ~= <= >= < > = ( ) { } [ ] :: ; : , . .. ... - -</pre> +</pre></p> <p> <i>Literal strings</i> @@ -631,7 +629,7 @@ As an example the five literal strings below denote the same string: -<pre> +<p><pre> a = 'alo\n123"' a = "alo\n123\"" a = '\97lo\10\04923"' @@ -640,8 +638,7 @@ a = [==[ alo 123"]==] - -</pre> +</pre></p> <p> A <i>numerical constant</i> (or <i>numeral</i>) @@ -658,17 +655,17 @@ otherwise it denotes an integer. Examples of valid integer constants are -<pre> +<p><pre> 3 345 0xff 0xBEBADA - -</pre><p> +</pre></p> + +<p> Examples of valid float constants are -<pre> +<p><pre> 3.0 3.1416 314.16e-2 0.31416E1 34e1 0x0.1E 0xA23p-4 0X1.921FB54442D18P+1 - -</pre> +</pre></p> <p> A <i>comment</i> starts with a double hyphen (<tt>--</tt>) @@ -697,10 +694,11 @@ (or a function's formal parameter, which is a particular kind of local variable): -<pre> +<p><pre> var ::= Name - -</pre><p> +</pre></p> + +<p> Name denotes identifiers, as defined in <a href="#3.1">§3.1</a>. @@ -719,10 +717,11 @@ <p> Square brackets are used to index a table: -<pre> +<p><pre> var ::= prefixexp ‘<b>[</b>’ exp ‘<b>]</b>’ - -</pre><p> +</pre></p> + +<p> The meaning of accesses to table fields can be changed via metatables. An access to an indexed variable <tt>t[i]</tt> is equivalent to a call <tt>gettable_event(t,i)</tt>. @@ -736,10 +735,9 @@ The syntax <tt>var.Name</tt> is just syntactic sugar for <tt>var["Name"]</tt>: -<pre> +<p><pre> var ::= prefixexp ‘<b>.</b>’ Name - -</pre> +</pre></p> <p> An access to a global variable <tt>x</tt>