comparison website/src/manual.html.luan @ 464:eddf7c73373b

fix references in the manual
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 07 May 2015 21:31:19 -0600
parents e3a6d9dbd694
children 47c7de1f2322
comparison
equal deleted inserted replaced
463:895afcd2b281 464:eddf7c73373b
75 <li><a href="#constructors">Table Constructors</a></li> 75 <li><a href="#constructors">Table Constructors</a></li>
76 <li><a href="#fn_calls">Function Calls</a></li> 76 <li><a href="#fn_calls">Function Calls</a></li>
77 <li><a href="#fn_def">Function Definitions</a></li> 77 <li><a href="#fn_def">Function Definitions</a></li>
78 </ul> 78 </ul>
79 </li> 79 </li>
80 <li><a href="#visibility">>Visibility Rules</a></li> 80 <li><a href="#visibility">Visibility Rules</a></li>
81 </ul> 81 </ul>
82 </div> 82 </div>
83 83
84 <hr/> 84 <hr/>
85 85
133 <i>Binary</i> is implemented as the Java type <i>byte[]</i>. 133 <i>Binary</i> is implemented as the Java type <i>byte[]</i>.
134 134
135 135
136 <p> 136 <p>
137 Luan can call (and manipulate) functions written in Luan and 137 Luan can call (and manipulate) functions written in Luan and
138 functions written in Java (see <a href="#3.4.10">&sect;3.4.10</a>). 138 functions written in Java (see <a href="#fn_calls">Function Calls</a>).
139 Both are represented by the type <i>function</i>. 139 Both are represented by the type <i>function</i>.
140 140
141 141
142 <p> 142 <p>
143 The type <i>userdata</i> is provided to allow arbitrary Java objects to 143 The type <i>userdata</i> is provided to allow arbitrary Java objects to
166 symbol tables, sets, records, graphs, trees, etc. 166 symbol tables, sets, records, graphs, trees, etc.
167 To represent records, Luan uses the field name as an index. 167 To represent records, Luan uses the field name as an index.
168 The language supports this representation by 168 The language supports this representation by
169 providing <tt>a.name</tt> as syntactic sugar for <tt>a["name"]</tt>. 169 providing <tt>a.name</tt> as syntactic sugar for <tt>a["name"]</tt>.
170 There are several convenient ways to create tables in Luan 170 There are several convenient ways to create tables in Luan
171 (see <a href="#3.4.9">&sect;3.4.9</a>). 171 (see <a href="#constructors">Table Constructors</a>).
172 172
173 173
174 <p> 174 <p>
175 We use the term <i>sequence</i> to denote a table where 175 We use the term <i>sequence</i> to denote a table where
176 the set of all positive numeric keys is equal to {1..<i>n</i>} 176 the set of all positive numeric keys is equal to {1..<i>n</i>}
177 for some non-negative integer <i>n</i>, 177 for some non-negative integer <i>n</i>,
178 which is called the length of the sequence (see <a href="#3.4.7">&sect;3.4.7</a>). 178 which is called the length of the sequence (see <a href="#length">The Length Operator</a>).
179 179
180 180
181 <p> 181 <p>
182 Like indices, 182 Like indices,
183 the values of table fields can be of any type. 183 the values of table fields can be of any type.
184 In particular, 184 In particular,
185 because functions are first-class values, 185 because functions are first-class values,
186 table fields can contain functions. 186 table fields can contain functions.
187 Thus tables can also carry <i>methods</i> (see <a href="#3.4.11">&sect;3.4.11</a>). 187 Thus tables can also carry <i>methods</i> (see <a href="#fn_def">Function Definitions</a>).
188 188
189 189
190 <p> 190 <p>
191 The indexing of tables follows 191 The indexing of tables follows
192 the definition of raw equality in the language. 192 the definition of raw equality in the language.
217 217
218 218
219 <h3 margin-top="1em"><a name="env">Environments</a></h3> 219 <h3 margin-top="1em"><a name="env">Environments</a></h3>
220 220
221 <p> 221 <p>
222 As will be discussed in <a href="#3.2">&sect;3.2</a> and <a href="#3.3.3">&sect;3.3.3</a>, 222 As will be discussed in <a href="#vars">Variables</a> and <a href=#assignment">Assignment</a>,
223 any reference to a free name 223 any reference to a free name
224 (that is, a name not bound to any declaration) <tt>var</tt> 224 (that is, a name not bound to any declaration) <tt>var</tt>
225 is syntactically translated to <tt>_ENV.var</tt>. 225 is syntactically translated to <tt>_ENV.var</tt>.
226 Moreover, every chunk is compiled in the scope of 226 Moreover, every chunk is compiled in the scope of
227 an external local variable named <tt>_ENV</tt> (see <a href="#3.3.2">&sect;3.3.2</a>), 227 an external local variable named <tt>_ENV</tt> (see <a href="#chunks">Chunks</a>),
228 so <tt>_ENV</tt> itself is never a free name in a chunk. 228 so <tt>_ENV</tt> itself is never a free name in a chunk.
229 229
230 230
231 <p> 231 <p>
232 Despite the existence of this external <tt>_ENV</tt> variable and 232 Despite the existence of this external <tt>_ENV</tt> variable and
234 <tt>_ENV</tt> is a completely regular name. 234 <tt>_ENV</tt> is a completely regular name.
235 In particular, 235 In particular,
236 you can define new variables and parameters with that name. 236 you can define new variables and parameters with that name.
237 Each reference to a free name uses the <tt>_ENV</tt> that is 237 Each reference to a free name uses the <tt>_ENV</tt> that is
238 visible at that point in the program, 238 visible at that point in the program,
239 following the usual visibility rules of Luan (see <a href="#3.5">&sect;3.5</a>). 239 following the usual visibility rules of Luan (see <a href="#visibility">Visibility Rules</a>).
240 240
241 241
242 <p> 242 <p>
243 Any table used as the value of <tt>_ENV</tt> is called an <i>environment</i>. 243 Any table used as the value of <tt>_ENV</tt> is called an <i>environment</i>.
244 244
401 Luan calls it with the object as argument, 401 Luan calls it with the object as argument,
402 and the result of the call 402 and the result of the call
403 (always adjusted to one value) 403 (always adjusted to one value)
404 is the result of the operation. 404 is the result of the operation.
405 If there is no metamethod but the object is a table, 405 If there is no metamethod but the object is a table,
406 then Luan uses the table length operation (see <a href="#3.4.7">&sect;3.4.7</a>). 406 then Luan uses the table length operation (see <a href="#length">The Length Operator</a>).
407 Otherwise, Luan raises an error. 407 Otherwise, Luan raises an error.
408 </li> 408 </li>
409 409
410 <li><b>"eq": </b> 410 <li><b>"eq": </b>
411 the <tt>==</tt> (equal) operation. 411 the <tt>==</tt> (equal) operation.
724 <p><tt><pre> 724 <p><tt><pre>
725 var ::= Name 725 var ::= Name
726 </pre></tt></p> 726 </pre></tt></p>
727 727
728 <p> 728 <p>
729 Name denotes identifiers, as defined in <a href="#3.1">&sect;3.1</a>. 729 Name denotes identifiers, as defined in <a href="#lex">Lexical Conventions</a>.
730 730
731 731
732 <p> 732 <p>
733 Any variable name is assumed to be global unless explicitly declared 733 Any variable name is assumed to be global unless explicitly declared
734 as a local (see <a href="#3.3.7">&sect;3.3.7</a>). 734 as a local (see <a href="#local_stmt">Local Declarations</a>).
735 Local variables are <i>lexically scoped</i>: 735 Local variables are <i>lexically scoped</i>:
736 local variables can be freely accessed by functions 736 local variables can be freely accessed by functions
737 defined inside their scope (see <a href="#3.5">&sect;3.5</a>). 737 defined inside their scope (see <a href="#visibility">Visibility Rules</a>).
738 738
739 739
740 <p> 740 <p>
741 Before the first assignment to a variable, its value is <b>nil</b>. 741 Before the first assignment to a variable, its value is <b>nil</b>.
742 742
750 750
751 <p> 751 <p>
752 The meaning of accesses to table fields can be changed via metatables. 752 The meaning of accesses to table fields can be changed via metatables.
753 An access to an indexed variable <tt>t[i]</tt> is equivalent to 753 An access to an indexed variable <tt>t[i]</tt> is equivalent to
754 a call <tt>gettable_event(t,i)</tt>. 754 a call <tt>gettable_event(t,i)</tt>.
755 (See <a href="#2.4">&sect;2.4</a> for a complete description of the 755 (See <a href="#meta">Metatables and Metamethods</a> for a complete description of the
756 <tt>gettable_event</tt> function. 756 <tt>gettable_event</tt> function.
757 This function is not defined or callable in Luan. 757 This function is not defined or callable in Luan.
758 We use it here only for explanatory purposes.) 758 We use it here only for explanatory purposes.)
759 759
760 760
768 768
769 <p> 769 <p>
770 An access to a global variable <tt>x</tt> 770 An access to a global variable <tt>x</tt>
771 is equivalent to <tt>_ENV.x</tt>. 771 is equivalent to <tt>_ENV.x</tt>.
772 Due to the way that chunks are compiled, 772 Due to the way that chunks are compiled,
773 <tt>_ENV</tt> is never a global name (see <a href="#2.2">&sect;2.2</a>). 773 <tt>_ENV</tt> is never a global name (see <a href="#env">Environments</a>).
774 774
775 775
776 776
777 777
778 778
817 <p> 817 <p>
818 Explicit blocks are useful 818 Explicit blocks are useful
819 to control the scope of variable declarations. 819 to control the scope of variable declarations.
820 Explicit blocks are also sometimes used to 820 Explicit blocks are also sometimes used to
821 add a <b>return</b> statement in the middle 821 add a <b>return</b> statement in the middle
822 of another block (see <a href="#3.3.4">&sect;3.3.4</a>). 822 of another block (see <a href="#control">Control Structures</a>).
823 823
824 824
825 825
826 826
827 827
837 </pre></tt></p> 837 </pre></tt></p>
838 838
839 <p> 839 <p>
840 Luan handles a chunk as the body of an anonymous function 840 Luan handles a chunk as the body of an anonymous function
841 with a variable number of arguments 841 with a variable number of arguments
842 (see <a href="#3.4.11">&sect;3.4.11</a>). 842 (see <a href="#fn_def">Function Definitions</a>).
843 As such, chunks can define local variables, 843 As such, chunks can define local variables,
844 receive arguments, and return values. 844 receive arguments, and return values.
845 845
846 846
847 <p> 847 <p>
869 varlist ::= var {&lsquo;<b>,</b>&rsquo; var} 869 varlist ::= var {&lsquo;<b>,</b>&rsquo; var}
870 explist ::= exp {&lsquo;<b>,</b>&rsquo; exp} 870 explist ::= exp {&lsquo;<b>,</b>&rsquo; exp}
871 </pre></tt></p> 871 </pre></tt></p>
872 872
873 <p> 873 <p>
874 Expressions are discussed in <a href="#3.4">&sect;3.4</a>. 874 Expressions are discussed in <a href="#expressions">Expressions</a>.
875 875
876 876
877 <p> 877 <p>
878 Before the assignment, 878 Before the assignment,
879 the list of values is <i>adjusted</i> to the length of 879 the list of values is <i>adjusted</i> to the length of
883 If there are fewer values than needed, 883 If there are fewer values than needed,
884 the list is extended with as many <b>nil</b>'s as needed. 884 the list is extended with as many <b>nil</b>'s as needed.
885 If the list of expressions ends with a function call, 885 If the list of expressions ends with a function call,
886 then all values returned by that call enter the list of values, 886 then all values returned by that call enter the list of values,
887 before the adjustment 887 before the adjustment
888 (except when the call is enclosed in parentheses; see <a href="#3.4">&sect;3.4</a>). 888 (except when the call is enclosed in parentheses; see <a href="#expressions">Expressions</a>).
889 889
890 890
891 <p> 891 <p>
892 The assignment statement first evaluates all its expressions 892 The assignment statement first evaluates all its expressions
893 and only then the assignments are performed. 893 and only then the assignments are performed.
923 <p> 923 <p>
924 The meaning of assignments to global variables 924 The meaning of assignments to global variables
925 and table fields can be changed via metatables. 925 and table fields can be changed via metatables.
926 An assignment to an indexed variable <tt>t[i] = val</tt> is equivalent to 926 An assignment to an indexed variable <tt>t[i] = val</tt> is equivalent to
927 <tt>settable_event(t,i,val)</tt>. 927 <tt>settable_event(t,i,val)</tt>.
928 (See <a href="#2.4">&sect;2.4</a> for a complete description of the 928 (See <a href="#meta">Metatables and Metamethods</a> for a complete description of the
929 <tt>settable_event</tt> function. 929 <tt>settable_event</tt> function.
930 This function is not defined or callable in Luan. 930 This function is not defined or callable in Luan.
931 We use it here only for explanatory purposes.) 931 We use it here only for explanatory purposes.)
932 932
933 933
934 <p> 934 <p>
935 An assignment to a global name <tt>x = val</tt> 935 An assignment to a global name <tt>x = val</tt>
936 is equivalent to the assignment 936 is equivalent to the assignment
937 <tt>_ENV.x = val</tt> (see <a href="#2.2">&sect;2.2</a>). 937 <tt>_ENV.x = val</tt> (see <a href="#env">Environments</a>).
938 938
939 939
940 940
941 941
942 <h4 margin-top="1em"><a name="control">Control Structures</a></h4> 942 <h4 margin-top="1em"><a name="control">Control Structures</a></h4>
951 stat ::= <b>repeat</b> block <b>until</b> exp 951 stat ::= <b>repeat</b> block <b>until</b> exp
952 stat ::= <b>if</b> exp <b>then</b> block {<b>elseif</b> exp <b>then</b> block} [<b>else</b> block] <b>end</b> 952 stat ::= <b>if</b> exp <b>then</b> block {<b>elseif</b> exp <b>then</b> block} [<b>else</b> block] <b>end</b>
953 </pre></tt></p> 953 </pre></tt></p>
954 954
955 <p> 955 <p>
956 Luan also has a <b>for</b> statement (see <a href="#3.3.5">&sect;3.3.5</a>). 956 Luan also has a <b>for</b> statement (see <a href="#for">For Statement</a>).
957 957
958 958
959 <p> 959 <p>
960 The condition expression of a 960 The condition expression of a
961 control structure must be a boolean. 961 control structure must be a boolean.
1076 stat ::= functioncall 1076 stat ::= functioncall
1077 </pre></tt></p> 1077 </pre></tt></p>
1078 1078
1079 <p> 1079 <p>
1080 In this case, all returned values are thrown away. 1080 In this case, all returned values are thrown away.
1081 Function calls are explained in <a href="#3.4.10">&sect;3.4.10</a>. 1081 Function calls are explained in <a href="#fn_calls">Function Calls</a>.
1082 1082
1083 1083
1084 1084
1085 <h4 margin-top="1em"><a name="local_stmt">Local Declarations</a></h4> 1085 <h4 margin-top="1em"><a name="local_stmt">Local Declarations</a></h4>
1086 1086
1092 stat ::= <b>local</b> namelist [&lsquo;<b>=</b>&rsquo; explist] 1092 stat ::= <b>local</b> namelist [&lsquo;<b>=</b>&rsquo; explist]
1093 </pre></tt></p> 1093 </pre></tt></p>
1094 1094
1095 <p> 1095 <p>
1096 If present, an initial assignment has the same semantics 1096 If present, an initial assignment has the same semantics
1097 of a multiple assignment (see <a href="#3.3.3">&sect;3.3.3</a>). 1097 of a multiple assignment (see <a href="#assignment">Assignment</a>).
1098 Otherwise, all variables are initialized with <b>nil</b>. 1098 Otherwise, all variables are initialized with <b>nil</b>.
1099 1099
1100 1100
1101 <p> 1101 <p>
1102 A chunk is also a block (see <a href="#3.3.2">&sect;3.3.2</a>), 1102 A chunk is also a block (see <a href="#chunks">Chunks</a>),
1103 and so local variables can be declared in a chunk outside any explicit block. 1103 and so local variables can be declared in a chunk outside any explicit block.
1104 1104
1105 1105
1106 <p> 1106 <p>
1107 The visibility rules for local variables are explained in <a href="#3.5">&sect;3.5</a>. 1107 The visibility rules for local variables are explained in <a href="#visibility">Visibility Rules</a>.
1108 1108
1109 1109
1110 1110
1111 1111
1112 <h3 margin-top="1em"><a name="expressions">Expressions</a></h3> 1112 <h3 margin-top="1em"><a name="expressions">Expressions</a></h3>
1126 exp ::= unop exp 1126 exp ::= unop exp
1127 prefixexp ::= var | functioncall | &lsquo;<b>(</b>&rsquo; exp &lsquo;<b>)</b>&rsquo; 1127 prefixexp ::= var | functioncall | &lsquo;<b>(</b>&rsquo; exp &lsquo;<b>)</b>&rsquo;
1128 </pre></tt></p> 1128 </pre></tt></p>
1129 1129
1130 <p> 1130 <p>
1131 Numerals and literal strings are explained in <a href="#3.1">&sect;3.1</a>; 1131 Numerals and literal strings are explained in <a href="#lex">Lexical Conventions</a>;
1132 variables are explained in <a href="#3.2">&sect;3.2</a>; 1132 variables are explained in <a href="#vars">Variables</a>;
1133 function definitions are explained in <a href="#3.4.11">&sect;3.4.11</a>; 1133 function definitions are explained in <a href="#fn_def">Function Definitions</a>;
1134 function calls are explained in <a href="#3.4.10">&sect;3.4.10</a>; 1134 function calls are explained in <a href="#fn_calls">Function Calls</a>;
1135 table constructors are explained in <a href="#3.4.9">&sect;3.4.9</a>. 1135 table constructors are explained in <a href="#constructors">Table Constructors</a>.
1136 Vararg expressions, 1136 Vararg expressions,
1137 denoted by three dots ('<tt>...</tt>'), can only be used when 1137 denoted by three dots ('<tt>...</tt>'), can only be used when
1138 directly inside a vararg function; 1138 directly inside a vararg function;
1139 they are explained in <a href="#3.4.11">&sect;3.4.11</a>. 1139 they are explained in <a href="#fn_def">Function Definitions</a>.
1140 1140
1141 1141
1142 <p> 1142 <p>
1143 Binary operators comprise arithmetic operators (see <a href="#3.4.1">&sect;3.4.1</a>), 1143 Binary operators comprise arithmetic operators (see <a href="#arithmetic">Arithmetic Operators</a>),
1144 relational operators (see <a href="#3.4.4">&sect;3.4.4</a>), logical operators (see <a href="#3.4.5">&sect;3.4.5</a>), 1144 relational operators (see <a href="#relational">Relational Operators</a>), logical operators (see <a href="#logical_ops">Logical Operators</a>),
1145 and the concatenation operator (see <a href="#3.4.6">&sect;3.4.6</a>). 1145 and the concatenation operator (see <a href="#concatenation">Concatenation</a>).
1146 Unary operators comprise the unary minus (see <a href="#3.4.1">&sect;3.4.1</a>), 1146 Unary operators comprise the unary minus (see <a href="#arithmetic">Arithmetic Operators</a>),
1147 the unary logical <b>not</b> (see <a href="#3.4.5">&sect;3.4.5</a>), 1147 the unary logical <b>not</b> (see <a href="#logical_ops">Logical Operators</a>),
1148 and the unary <em>length operator</em> (see <a href="#3.4.7">&sect;3.4.7</a>). 1148 and the unary <em>length operator</em> (see <a href="#length">The Length Operator</a>).
1149 1149
1150 1150
1151 <p> 1151 <p>
1152 Both function calls and vararg expressions can result in multiple values. 1152 Both function calls and vararg expressions can result in multiple values.
1153 If a function call is used as a statement (see <a href="#3.3.6">&sect;3.3.6</a>), 1153 If a function call is used as a statement (see <a href="#fn_stmt">Function Calls as Statements</a>),
1154 then its return list is adjusted to zero elements, 1154 then its return list is adjusted to zero elements,
1155 thus discarding all returned values. 1155 thus discarding all returned values.
1156 If an expression is used as the last (or the only) element 1156 If an expression is used as the last (or the only) element
1157 of a list of expressions, 1157 of a list of expressions,
1158 then no adjustment is made 1158 then no adjustment is made
1264 it is different from any previously existing table. 1264 it is different from any previously existing table.
1265 Closures are also compared by reference. 1265 Closures are also compared by reference.
1266 1266
1267 <p> 1267 <p>
1268 You can change the way that Luan compares tables 1268 You can change the way that Luan compares tables
1269 by using the "eq" metamethod (see <a href="#2.4">&sect;2.4</a>). 1269 by using the "eq" metamethod (see <a href="#meta">Metatables and Metamethods</a>).
1270 1270
1271 <p> 1271 <p>
1272 Userdata are Java objects. They are compared for equality with the Java <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object)"><tt>equals</tt></a> method. 1272 Userdata are Java objects. They are compared for equality with the Java <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object)"><tt>equals</tt></a> method.
1273 1273
1274 <p> 1274 <p>
1290 then they are compared following 1290 then they are compared following
1291 the usual rule for binary operations. 1291 the usual rule for binary operations.
1292 Otherwise, if both arguments are strings, 1292 Otherwise, if both arguments are strings,
1293 then their values are compared according to the current locale. 1293 then their values are compared according to the current locale.
1294 Otherwise, Luan tries to call the "lt" or the "le" 1294 Otherwise, Luan tries to call the "lt" or the "le"
1295 metamethod (see <a href="#2.4">&sect;2.4</a>). 1295 metamethod (see <a href="#meta">Metatables and Metamethods</a>).
1296 A comparison <tt>a &gt; b</tt> is translated to <tt>b &lt; a</tt> 1296 A comparison <tt>a &gt; b</tt> is translated to <tt>b &lt; a</tt>
1297 and <tt>a &gt;= b</tt> is translated to <tt>b &lt;= a</tt>. 1297 and <tt>a &gt;= b</tt> is translated to <tt>b &lt;= a</tt>.
1298 1298
1299 1299
1300 1300
1305 <p> 1305 <p>
1306 The logical operators in Luan are 1306 The logical operators in Luan are
1307 <b>and</b>, <b>or</b>, and <b>not</b>. 1307 <b>and</b>, <b>or</b>, and <b>not</b>.
1308 The <b>and</b> and <b>or</b> operators consider both <b>false</b> and <b>nil</b> as false 1308 The <b>and</b> and <b>or</b> operators consider both <b>false</b> and <b>nil</b> as false
1309 and anything else as true. 1309 and anything else as true.
1310 Like the control structures (see <a href="#3.3.4">&sect;3.3.4</a>), 1310 Like the control structures (see <a href="#control">Control Structures</a>),
1311 the <b>not</b> operator requires a boolean value. 1311 the <b>not</b> operator requires a boolean value.
1312 1312
1313 <p> 1313 <p>
1314 The negation operator <b>not</b> always returns <b>false</b> or <b>true</b>. 1314 The negation operator <b>not</b> always returns <b>false</b> or <b>true</b>.
1315 The conjunction operator <b>and</b> returns its first argument 1315 The conjunction operator <b>and</b> returns its first argument
1357 The length of a binary is its number of bytes. 1357 The length of a binary is its number of bytes.
1358 1358
1359 1359
1360 <p> 1360 <p>
1361 A program can modify the behavior of the length operator for 1361 A program can modify the behavior of the length operator for
1362 any table through the <tt>__len</tt> metamethod (see <a href="#2.4">&sect;2.4</a>). 1362 any table through the <tt>__len</tt> metamethod (see <a href="#meta">Metatables and Metamethods</a>).
1363 1363
1364 1364
1365 <p> 1365 <p>
1366 Unless a <tt>__len</tt> metamethod is given, 1366 Unless a <tt>__len</tt> metamethod is given,
1367 the length of a table <tt>t</tt> is defined 1367 the length of a table <tt>t</tt> is defined
1466 1466
1467 <p> 1467 <p>
1468 If the last field in the list has the form <tt>exp</tt> 1468 If the last field in the list has the form <tt>exp</tt>
1469 and the expression is a function call or a vararg expression, 1469 and the expression is a function call or a vararg expression,
1470 then all values returned by this expression enter the list consecutively 1470 then all values returned by this expression enter the list consecutively
1471 (see <a href="#3.4.10">&sect;3.4.10</a>). 1471 (see <a href="#fn_calls">Function Calls</a>).
1472 1472
1473 1473
1474 <p> 1474 <p>
1475 The field list can have an optional trailing separator, 1475 The field list can have an optional trailing separator,
1476 as a convenience for machine-generated code. 1476 as a convenience for machine-generated code.
1495 then this function is called 1495 then this function is called
1496 with the given arguments. 1496 with the given arguments.
1497 Otherwise, the prefixexp "call" metamethod is called, 1497 Otherwise, the prefixexp "call" metamethod is called,
1498 having as first parameter the value of prefixexp, 1498 having as first parameter the value of prefixexp,
1499 followed by the original call arguments 1499 followed by the original call arguments
1500 (see <a href="#2.4">&sect;2.4</a>). 1500 (see <a href="#meta">Metatables and Metamethods</a>).
1501 1501
1502 1502
1503 <p> 1503 <p>
1504 Arguments have the following syntax: 1504 Arguments have the following syntax:
1505 1505
1688 g(3, 4, 5, 8) a=3, b=4, ... --&gt; 5 8 1688 g(3, 4, 5, 8) a=3, b=4, ... --&gt; 5 8
1689 g(5, r()) a=5, b=1, ... --&gt; 2 3 1689 g(5, r()) a=5, b=1, ... --&gt; 2 3
1690 </pre></tt></p> 1690 </pre></tt></p>
1691 1691
1692 <p> 1692 <p>
1693 Results are returned using the <b>return</b> statement (see <a href="#3.3.4">&sect;3.3.4</a>). 1693 Results are returned using the <b>return</b> statement (see <a href="#control">Control Structures</a>).
1694 If control reaches the end of a function 1694 If control reaches the end of a function
1695 without encountering a <b>return</b> statement, 1695 without encountering a <b>return</b> statement,
1696 then the function returns with no results. 1696 then the function returns with no results.
1697 1697
1698 1698