Mercurial Hosting > luan
comparison website/src/manual.html.luan @ 513:0dfc01d8d42d
rename type "userdata" to "java"
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 24 May 2015 12:05:00 -0600 |
parents | d96944467ffc |
children | b1256e2d19a3 |
comparison
equal
deleted
inserted
replaced
512:d96944467ffc | 513:0dfc01d8d42d |
---|---|
127 | 127 |
128 | 128 |
129 <p> | 129 <p> |
130 There are eight basic types in Luan: | 130 There are eight basic types in Luan: |
131 <i>nil</i>, <i>boolean</i>, <i>number</i>, | 131 <i>nil</i>, <i>boolean</i>, <i>number</i>, |
132 <i>string</i>, <i>binary</i>, <i>function</i>, <i>userdata</i>, | 132 <i>string</i>, <i>binary</i>, <i>function</i>, <i>java</i>, |
133 and <i>table</i>. | 133 and <i>table</i>. |
134 <i>Nil</i> is the type of the value <b>nil</b>, | 134 <i>Nil</i> is the type of the value <b>nil</b>, |
135 whose main property is to be different from any other value; | 135 whose main property is to be different from any other value; |
136 it usually represents the absence of a useful value. | 136 it usually represents the absence of a useful value. |
137 <i>Nil</i> is implemented as the Java value <i>null</i>. | 137 <i>Nil</i> is implemented as the Java value <i>null</i>. |
151 functions written in Java (see <a href="#fn_calls">Function Calls</a>). | 151 functions written in Java (see <a href="#fn_calls">Function Calls</a>). |
152 Both are represented by the type <i>function</i>. | 152 Both are represented by the type <i>function</i>. |
153 | 153 |
154 | 154 |
155 <p> | 155 <p> |
156 The type <i>userdata</i> is provided to allow arbitrary Java objects to | 156 The type <i>java</i> is provided to allow arbitrary Java objects to |
157 be stored in Luan variables. | 157 be stored in Luan variables. |
158 A userdata value is a Java object that isn't one of the standard Luan types. | 158 A <i>java</i> value is a Java object that isn't one of the standard Luan types. |
159 Userdata has no predefined operations in Luan, | 159 Java values have no predefined operations in Luan, |
160 except assignment and identity test. | 160 except assignment and identity test. |
161 Userdata is useful then Java access is enabled in Luan | 161 Java values are useful when Java access is enabled in Luan |
162 | 162 |
163 | 163 |
164 | 164 |
165 <p> | 165 <p> |
166 The type <i>table</i> implements associative arrays, | 166 The type <i>table</i> implements associative arrays, |
1265 <p> | 1265 <p> |
1266 You can change the way that Luan compares tables | 1266 You can change the way that Luan compares tables |
1267 by using the "eq" metamethod (see <a href="#meta">Metatables and Metamethods</a>). | 1267 by using the "eq" metamethod (see <a href="#meta">Metatables and Metamethods</a>). |
1268 | 1268 |
1269 <p> | 1269 <p> |
1270 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. | 1270 Java values 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. |
1271 | 1271 |
1272 <p> | 1272 <p> |
1273 Equality comparisons do not convert strings to numbers | 1273 Equality comparisons do not convert strings to numbers |
1274 or vice versa. | 1274 or vice versa. |
1275 Thus, <tt>"0"==0</tt> evaluates to <b>false</b>, | 1275 Thus, <tt>"0"==0</tt> evaluates to <b>false</b>, |
2258 "<tt>string</tt>", | 2258 "<tt>string</tt>", |
2259 "<tt>binary</tt>", | 2259 "<tt>binary</tt>", |
2260 "<tt>boolean</tt>", | 2260 "<tt>boolean</tt>", |
2261 "<tt>table</tt>", | 2261 "<tt>table</tt>", |
2262 "<tt>function</tt>", | 2262 "<tt>function</tt>", |
2263 and "<tt>userdata</tt>". | 2263 and "<tt>java</tt>". |
2264 | 2264 |
2265 | 2265 |
2266 <h4 <%=heading_options%> ><a name="Luan.values"><tt>Luan.values (···)</tt></a></h4> | 2266 <h4 <%=heading_options%> ><a name="Luan.values"><tt>Luan.values (···)</tt></a></h4> |
2267 | 2267 |
2268 <p> | 2268 <p> |