comparison website/src/manual.html.luan @ 799:9c13a15a4002

Package.load() now returns false instead of null, and caches the result. This cleans up the luan.isLocked issues.
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 06 Sep 2016 18:03:19 -0600
parents 60661a8e738c
children 616761e0b9f6
comparison
equal deleted inserted replaced
798:9eccfede1094 799:9c13a15a4002
2266 2266
2267 <p> 2267 <p>
2268 To load a new value, <code>Package.load</code> first checks if <code>mod_uri</code> starts with "<b>java:</b>". If yes, then this is a Java class which is loaded by special Java code. 2268 To load a new value, <code>Package.load</code> first checks if <code>mod_uri</code> starts with "<b>java:</b>". If yes, then this is a Java class which is loaded by special Java code.
2269 2269
2270 <p> 2270 <p>
2271 If <code>mod_uri</code> is not a Java class, then <code>Package.load</code> tries to read the text of the file referred to by <code>mod_uri</code>. If the file doesn't exist, then <code>Package.load</code> returns <b>nil</b>. If the file exists, then its content is compiled into a chunk calling <a href="#Luan.load"><code>Luan.load</code></a> and passing in an empty table as the <code>env</code> value. This chunk is run passing in <code>mod_uri</code> as an argument. If the chunk returns a value other than <b>nil</b>, then that value is the value of this module. Otherwise the <code>env</code> that was passed in is the value of this module. 2271 Otherwise <code>Package.load</code> tries to read the text of the file referred to by <code>mod_uri</code>. If the file doesn't exist, then <code>Package.load</code> returns <b>false</b>. If the file exists, then its content is compiled into a chunk by calling <a href="#Luan.load"><code>Luan.load</code></a>. This chunk is run passing in <code>mod_uri</code> as an argument. The value returned by the chunk must not be <b>nil</b> and is loaded.
2272 2272
2273 <p> 2273 <p>
2274 If a new value for the module successful loaded, then it is stored in <code>Package.loaded[mod_uri]</code>. The value is returned. 2274 If a new value for the module successful loaded, then it is stored in <code>Package.loaded[mod_uri]</code>. The value is returned.
2275 2275
2276 2276