]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Add more docs for bytecode load/save feature.
authorMike Pall <mike>
Mon, 13 Jun 2011 23:58:19 +0000 (01:58 +0200)
committerMike Pall <mike>
Mon, 13 Jun 2011 23:58:19 +0000 (01:58 +0200)
doc/extensions.html
doc/running.html

index 7d12299c2b2e80631ddfd7109d1173609afbdb84..b0e11644ebc90259bf06e6f8301343f8c9bae0e2 100644 (file)
@@ -166,6 +166,23 @@ positive infinity results in <tt>"inf"</tt> and negative infinity results
 in <tt>"-inf"</tt>.
 </p>
 
+<h3 id="string_dump"><tt>string.dump(f [,strip])</tt> generates portable bytecode</h3>
+<p>
+An extra argument has been added to <tt>string.dump()</tt>. If set to
+<tt>true</tt>, 'stripped' bytecode without debug information is
+generated. This speeds up later bytecode loading and reduces memory
+usage. See also the
+<a href="running.html#opt_b"><tt>-b</tt> command line option</a>.
+</p>
+<p>
+The generated bytecode is portable and can be loaded on any architecture
+that LuaJIT supports, independent of word size or endianess. However the
+bytecode compatibility versions must match. Bytecode stays compatible
+for dot releases (x.y.0 &rarr; x.y.1), but may change with major or
+minor releases (2.0 &rarr; 2.1) or between any beta release. Foreign
+bytecode (e.g. from Lua 5.1) is incompatible and cannot be loaded.
+</p>
+
 <h3 id="math_random">Enhanced PRNG for <tt>math.random()</tt></h3>
 <p>
 LuaJIT uses a Tausworthe PRNG with period 2^223 to implement
index ecf6bba47827bfa94f9c8f484a6aad0c6e6f5d3b..118dab7b6cc686781a3cc9f7d5d446f1749b47d8 100644 (file)
@@ -133,6 +133,13 @@ luajit -bl test.lua                             # List to stdout
 luajit -bl test.lua test.txt                    # List to test.txt
 luajit -ble "print('hello world') end"          # List cmdline script
 </pre>
+<p>
+Note: A file in bytecode format is auto-detected and can be loaded like
+any Lua source file. E.g. directly from the command line or with
+<tt>loadfile()</tt>, <tt>dofile()</tt> etc. See also
+<a href="extensions.html#string_dump">string.dump()</a> for information
+on bytecode portability and compatibility.
+</p>
 
 <h3 id="opt_j"><tt>-j cmd[=arg[,arg...]]</tt></h3>
 <p>