diff options
Diffstat (limited to 'doc/luac.html')
-rw-r--r-- | doc/luac.html | 149 |
1 files changed, 51 insertions, 98 deletions
diff --git a/doc/luac.html b/doc/luac.html index 92d9ddf1..e083c2b3 100644 --- a/doc/luac.html +++ b/doc/luac.html @@ -1,4 +1,4 @@ -<!-- luac.man,v 1.17 1999/07/07 16:02:07 lhf Exp --> +<!-- luac.man,v 1.20 2000/10/06 15:11:21 lhf Exp --> <HTML> <HEAD> <TITLE>LUAC man page</TITLE> @@ -25,14 +25,11 @@ in C or with <B>dofile</B> in Lua. <P> -The main advantages of pre-compiling chunks are: +The main advantages of precompiling chunks are: faster loading, protecting source code from user changes, and off-line syntax error detection. -The binary files created by -<B>luac</B> -are portable to all architectures. <P> Pre-compiling does not imply faster execution because in Lua chunks are always compiled into bytecodes before being executed. @@ -49,126 +46,87 @@ but you can change this with the <B>-o</B> option. <P> +The binary files created by +<B>luac</B> +are portable to all architectures with the same word size. +This means that +binary files created on a 32-bit platform (such as Intel) +can be read without change in another 32-bit platform (such as Sparc), +even if the byte order (``endianess'') is different. +On the other hand, +binary files created on a 16-bit platform cannot be read in a 32-bit platform. +<P> +In the command line, +you can mix +text files containing Lua source and +binary files containing precompiled chunks. +This is useful to combine several precompiled chunks, +even from different (but compatible) platforms, +into a single precompiled chunk. +<P> You can use <B>"-"</B> to indicate <I>stdin</I> as a source file. <P> -<B>luac</B> -can also load and list binary files with the -<B>-u</B> -option. -<P> -Binary files produced by differents runs of -<B>luac</B> -(even in different machines) -can be combined into one large file, -using -<B>cat</B>(1). -The result is still a valid binary file -and can be loaded with a single call to -<B>lua_dofile</B> -or -<B>dofile</B>. -<P> The internal format of the binary files produced by <B>luac</B> may change when a new version of Lua is released. We try to maintain compatibility even for binary files, -but sometimes it cannot be done. +but it is not always possible. So, save the source files of all Lua programs that you precompile. <P> <H1>OPTIONS</H1> Options must be separate. <P> -<B>-c</B> -compile (this is the default). -<P> -<B>-u</B> -undump, i.e., load and list the given binary files. -If no files are given, then luac undumps -<B>luac.out</B>. -Listing a binary file is useful to learn Lua's virtual machine. -Listing is also useful to test the integrity of binary files: -corrupted files will probably generate errors when undumped. -To test without listing, use -<B>-q</B>. -For a thourough integrity test, -use -<B>-t</B>. -<P> -<B>-d</B> -turn debugging on. -Individual chunks may -still control the generation of debug information with -$debug and $nodebug. -If debugging is on, then listings show the names of the local variables. -<P> -<B>-D "</B><I>name"</I> -predefine symbol -<I>name</I> -for conditional compilation. -By default, -<B>luac</B> -does -<I>not</I> -predefine any symbols, -not even the built-in functions. -<P> <B>-l</B> produce a listing of the compiled bytecode for Lua's virtual machine. -This is the default when undumping. -<P> -<B>-n</B> -Save numbers in native format. -By default, -numbers are saved in text form, -for maximum portability. -Binary files with numbers in native format are slightly faster to load, -but are not completely portable. +Listing bytecodes is useful to learn about Lua's virtual machine. +If no files are given, then +<B>luac</B> +loads +<B>luac.out</B> +and lists its contents. <P> -<B>-o "</B><I>filename"</I> +<B>-o "</B><I>file"</I> output to -<I>filename</I>, +<I>file</I>, instead of the default <B>luac.out</B>. -The output file cannot be a source file. -<P> -<B>-O</B> -optimize. -Debug information is removed -and -duplicate constants are coalesced. +The output file can be a source file because +all files are loaded before the output file is written. <P> <B>-p</B> -parse sources files but do not generate any output file. -Used mainly for syntax checking. +load files but do not generate any output file. +Used mainly for syntax checking or testing precompiled chunks: +corrupted files will probably generate errors when loaded. +For a thourough integrity test, +use +<B>-t</B>. <P> -<B>-q</B> -quiet; produces no listing. -This is the default when compiling. +<B>-s</B> +strip debug information before writing the output file. +This saves some space in very large chunks, +but if errors occur when running these chunks, +then the error messages might not contain the full information they usually do. <P> <B>-t</B> -perform a thourough integrity test when undumping. +perform a thourough integrity test of precompiled chunks. Code that passes this test is completely safe, in the sense that it will not break the interpreter. However, there is no guarantee that such code does anything sensible. (None can be given, because the halting problem is unsolvable.) -<P> -<B>-U "</B><I>name"</I> -undefine symbol -<I>name</I> -for conditional compilation. +If no files are given, then +<B>luac</B> +loads +<B>luac.out</B> +and tests its contents. <P> <B>-v</B> print version information. -<P> -<B>-V</B> -verbose; -print the names of the source files as they are processed. <H1>FILES</H1> <P> <B>luac.out</B> @@ -176,19 +134,14 @@ default output file <H1>SEE ALSO</H1> <B>lua</B>(1) <BR> -<I>"Reference Manual of the Programming Language Lua"</I> -<BR> <A HREF="http://www.tecgraf.puc-rio.br/lua/">http://www.tecgraf.puc-rio.br/lua/</A> -<BR> -"Lua: an extensible extension language", -<I>Software: Practice & Experience</I> -<B>26</B> -#6 (1996) 635-652. <H1>DIAGNOSTICS</H1> Error messages should be self explanatory. <H1>AUTHORS</H1> L. H. de Figueiredo, R. Ierusalimschy and W. Celes -<I>(<A HREF="mailto:lua@tecgraf.puc-rio.br">lua@tecgraf.puc-rio.br</A>)</I> +(<A HREF="mailto:lua@tecgraf.puc-rio.br">lua@tecgraf.puc-rio.br</A>) <!-- EOF --> +</BODY> +</HTML> |