Mercurial Hosting > luan
diff website/src/manual.html @ 1434:56fb5cd8228d
cache compiled code in temp files
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 29 Dec 2019 15:25:07 -0700 |
parents | e48290f3d9fb |
children | d9a5405a3102 |
line wrap: on
line diff
--- a/website/src/manual.html Tue Dec 24 17:57:47 2019 -0700 +++ b/website/src/manual.html Sun Dec 29 15:25:07 2019 -0700 @@ -1812,7 +1812,7 @@ -<h4 heading><a name="Luan.eval" href="#Luan.eval"><code>Luan.eval (text [, source_name] [, env])</code></a></h4> +<h4 heading><a name="Luan.eval" href="#Luan.eval"><code>Luan.eval (text [, source_name [, env]])</code></a></h4> <p> Evaluates <code>text</code> as a Luan expression. @@ -1876,7 +1876,7 @@ -<h4 heading><a name="Luan.load" href="#Luan.load"><code>Luan.load (text, source_name [, env])</code></a></h4> +<h4 heading><a name="Luan.load" href="#Luan.load"><code>Luan.load (text, [source_name [, env [, persist]]])</code></a></h4> <p> Loads a chunk. @@ -1888,33 +1888,21 @@ otherwise, throws an error. <p> -The <code>source_name</code> parameter is a string saying where the text came from. It is used to produce error messages. +The <code>source_name</code> parameter is a string saying where the text came from. It is used to produce error messages. Defaults to "load". <p> If the <code>env</code> parameter is supplied, it becomes the <code>_ENV</code> of the chunk. - -<h4 heading><a name="Luan.load_file" href="#Luan.load_file"><code>Luan.load_file ([file_uri])</code></a></h4> +<p> +The <code>persist</code> parameter is a boolean which determines if the compiled code is persistently cached to a temporary file. Defaults to <code>false</code>. + + +<h4 heading><a name="Luan.load_file" href="#Luan.load_file"><code>Luan.load_file (file_uri)</code></a></h4> <p> Similar to <a href="#Luan.load"><code>load</code></a>, -but gets the chunk from file <code>file_uri</code> -or from the standard input, -if no file uri is given. - -<p> -Could be defined as: - -<pre> - function Luan.load_file(file_uri) - file_uri = file_uri or "stdin:" - local f = Io.uri(file_uri) - if not f.exists() then - return nil - end - return <a href="#Luan.load">Luan.load</a>( f.read_text(), file_uri ) - end -</pre> +but gets the chunk from file <code>file_uri</code>. +<code>file_uri</code> can be a string or a uri table. <h4 heading><a name="Luan.new_error" href="#Luan.new_error"><code>Luan.new_error (message)</code></a></h4>