Mercurial Hosting > luan
diff docs/manual.html @ 242:b5a926c481a5
Handle first h1 tag differently.
git-svn-id: https://luan-java.googlecode.com/svn/trunk@243 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | hugo.tech@gmail.com <hugo.tech@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 07 Oct 2014 01:43:07 +0000 |
parents | 852840d64a7f |
children | c912f6de2053 |
line wrap: on
line diff
--- a/docs/manual.html Mon Oct 06 22:32:30 2014 +0000 +++ b/docs/manual.html Tue Oct 07 01:43:07 2014 +0000 @@ -11,7 +11,7 @@ <body> <hr> -<h1> +<h1 class="main"> Luan Reference Manual </h1> @@ -176,7 +176,6 @@ For a detailed introduction to programming in Lua, see Roberto's book, <em>Programming in Lua</em>. - <h1>2 – <a name="2">Basic Concepts</a></h1> <p> @@ -1176,7 +1175,7 @@ print("foo", a) return coroutine.yield(2*a) end - + co = coroutine.create(function (a,b) print("co-body", a, b) local r = foo(a+1) @@ -1185,7 +1184,7 @@ print("co-body", r, s) return b, "end" end) - + print("main", coroutine.resume(co, 1, 10)) print("main", coroutine.resume(co, "r")) print("main", coroutine.resume(co, "x", "y")) @@ -1513,7 +1512,7 @@ <pre> a = b + c(print or io.write)('done') - + a = b + c; (print or io.write)('done') </pre><p> The current parser always sees such constructions @@ -1993,7 +1992,7 @@ a,b = ... -- a gets the first vararg parameter, b gets -- the second (both a and b can get nil if there -- is no corresponding vararg parameter) - + a,b,c = x, f() -- f() is adjusted to 2 results a,b,c = f() -- f() is adjusted to 3 results return f() -- returns all results from f() @@ -2464,13 +2463,13 @@ <pre> CALL PARAMETERS - + f(3) a=3, b=nil f(3, 4) a=3, b=4 f(3, 4, 5) a=3, b=4 f(r(), 10) a=1, b=10 f(r()) a=1, b=2 - + g(3) a=3, b=nil, ... --> (nothing) g(3, 4) a=3, b=4, ... --> (nothing) g(3, 4, 5, 8) a=3, b=4, ... --> 5 8 @@ -8130,21 +8129,21 @@ <pre> x = string.gsub("hello world", "(%w+)", "%1 %1") --> x="hello hello world world" - + x = string.gsub("hello world", "%w+", "%0 %0", 1) --> x="hello hello world" - + x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1") --> x="world hello Lua from" - + x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv) --> x="home = /home/roberto, user = roberto" - + x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s) return load(s)() end) --> x="4+5 = 9" - + local t = {name="lua", version="5.2"} x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t) --> x="lua-5.2.tar.gz" @@ -8817,7 +8816,7 @@ <p> When called without arguments, returns a uniform pseudo-random real number -in the range <em>[0,1)</em>. +in the range <em>[0,1)</em>. When called with an integer number <code>m</code>, <code>math.random</code> returns a uniform pseudo-random integer in the range <em>[1, m]</em>. @@ -10171,7 +10170,7 @@ <p> -When called without option <code>-E</code>, +When called without option <code>-E</code>, the interpreter checks for an environment variable <a name="pdf-LUA_INIT_5_2"><code>LUA_INIT_5_2</code></a> (or <a name="pdf-LUA_INIT"><code>LUA_INIT</code></a> if it is not defined) before running any argument. @@ -10517,21 +10516,21 @@ block ::= {stat} [retstat] - stat ::= ‘<b>;</b>’ | - varlist ‘<b>=</b>’ explist | - functioncall | - label | - <b>break</b> | - <b>goto</b> Name | - <b>do</b> block <b>end</b> | - <b>while</b> exp <b>do</b> block <b>end</b> | - <b>repeat</b> block <b>until</b> exp | - <b>if</b> exp <b>then</b> block {<b>elseif</b> exp <b>then</b> block} [<b>else</b> block] <b>end</b> | - <b>for</b> Name ‘<b>=</b>’ exp ‘<b>,</b>’ exp [‘<b>,</b>’ exp] <b>do</b> block <b>end</b> | - <b>for</b> namelist <b>in</b> explist <b>do</b> block <b>end</b> | - <b>function</b> funcname funcbody | - <b>local</b> <b>function</b> Name funcbody | - <b>local</b> namelist [‘<b>=</b>’ explist] + stat ::= ‘<b>;</b>’ | + varlist ‘<b>=</b>’ explist | + functioncall | + label | + <b>break</b> | + <b>goto</b> Name | + <b>do</b> block <b>end</b> | + <b>while</b> exp <b>do</b> block <b>end</b> | + <b>repeat</b> block <b>until</b> exp | + <b>if</b> exp <b>then</b> block {<b>elseif</b> exp <b>then</b> block} [<b>else</b> block] <b>end</b> | + <b>for</b> Name ‘<b>=</b>’ exp ‘<b>,</b>’ exp [‘<b>,</b>’ exp] <b>do</b> block <b>end</b> | + <b>for</b> namelist <b>in</b> explist <b>do</b> block <b>end</b> | + <b>function</b> funcname funcbody | + <b>local</b> <b>function</b> Name funcbody | + <b>local</b> namelist [‘<b>=</b>’ explist] retstat ::= <b>return</b> [explist] [‘<b>;</b>’] @@ -10541,20 +10540,20 @@ varlist ::= var {‘<b>,</b>’ var} - var ::= Name | prefixexp ‘<b>[</b>’ exp ‘<b>]</b>’ | prefixexp ‘<b>.</b>’ Name + var ::= Name | prefixexp ‘<b>[</b>’ exp ‘<b>]</b>’ | prefixexp ‘<b>.</b>’ Name namelist ::= Name {‘<b>,</b>’ Name} explist ::= exp {‘<b>,</b>’ exp} - exp ::= <b>nil</b> | <b>false</b> | <b>true</b> | Number | String | ‘<b>...</b>’ | functiondef | - prefixexp | tableconstructor | exp binop exp | unop exp + exp ::= <b>nil</b> | <b>false</b> | <b>true</b> | Number | String | ‘<b>...</b>’ | functiondef | + prefixexp | tableconstructor | exp binop exp | unop exp prefixexp ::= var | functioncall | ‘<b>(</b>’ exp ‘<b>)</b>’ - functioncall ::= prefixexp args | prefixexp ‘<b>:</b>’ Name args - - args ::= ‘<b>(</b>’ [explist] ‘<b>)</b>’ | tableconstructor | String + functioncall ::= prefixexp args | prefixexp ‘<b>:</b>’ Name args + + args ::= ‘<b>(</b>’ [explist] ‘<b>)</b>’ | tableconstructor | String functiondef ::= <b>function</b> funcbody @@ -10570,8 +10569,8 @@ fieldsep ::= ‘<b>,</b>’ | ‘<b>;</b>’ - binop ::= ‘<b>+</b>’ | ‘<b>-</b>’ | ‘<b>*</b>’ | ‘<b>/</b>’ | ‘<b>^</b>’ | ‘<b>%</b>’ | ‘<b>..</b>’ | - ‘<b><</b>’ | ‘<b><=</b>’ | ‘<b>></b>’ | ‘<b>>=</b>’ | ‘<b>==</b>’ | ‘<b>~=</b>’ | + binop ::= ‘<b>+</b>’ | ‘<b>-</b>’ | ‘<b>*</b>’ | ‘<b>/</b>’ | ‘<b>^</b>’ | ‘<b>%</b>’ | ‘<b>..</b>’ | + ‘<b><</b>’ | ‘<b><=</b>’ | ‘<b>></b>’ | ‘<b>>=</b>’ | ‘<b>==</b>’ | ‘<b>~=</b>’ | <b>and</b> | <b>or</b> unop ::= ‘<b>-</b>’ | <b>not</b> | ‘<b>#</b>’