Lua4.0 compiler documentation

Source: Internet
Author: User

Compilation document (luac.html ):
---------------------------------------------------------
Name
Luac-Lua Compiler

Summary
Luac [Options] [filenames]

Description
Luac is the Lua compiler. It translates programs written in Lua programming language into binary files.
You can call lua_dofile in C or call dofile in Lua to load and execute the generated binary file.

The main advantages of pre-compiled blocks are: faster loading to prevent source code from being modified by users and offline error detection.
Pre-compilation does not mean faster execution, because Lua blocks are always compiled into bytecode before execution. Luac can only store these bytecode in a file for future use.

Luac generates an output file containing the bytecode of all specified source files.
By default, the output file name is luac. Out.
But you can use the-O option to change it.

Binary files generated by luac are portable in all architectures with the same character length. This means that a binary file generated on a 32-bit platform (such as Intel) can be read by another 32-bit platform (such as Intel) without modification, even if the byte order is different (size side ). On the other hand, binary files generated on the 16-bit platform cannot be read on the 32-bit platform.
In the command line, you can mix text files that contain Lua source code and binary files that contain pre-compiled blocks. This allows us to merge several pre-compiled blocks into a pre-compiled block, even from different (but compatible) platforms.

You can use "-" to indicate that the standard input is used as the source file.

When a new version is released, the internal format of the binary file generated by luac may change. We try to maintain the compatibility of binary files, but it does not always work. Therefore, save all the source files of your pre-compiled Lua program.

Option
The options must be separated.
-L option to generate the compiled Lua Virtual Machine bytecode list. Listing bytecode helps you learn about Lua virtual machines. If no file is provided, luac loads luac. Out and lists its content.
 
-O outputs to the file, replacing the default luac. Out. The output file can be a source file because all files have been loaded before writing the output file.

-P loads the file without generating any output. It is mainly used for syntax checks or testing pre-compiled blocks. Damaged files may generate errors during loading. Use-T for a complete test.

-S strip debugging information before writing the output file. This saves some space in a very large block, but if an error occurs when these blocks are running, the error information may not contain the General complete information.

-T run the integrity test block on the pre-compiled block. The Code passed this test is completely secure, and in a sense it won't break the interpreter. However, the significance of such code is not guaranteed (no one can guarantee it, because the downtime problem is unsolved .). If no file is specified, luac loads luac. Out and tests its content.

-V: Output version information.

File
Luac. Out default output file.

For more information, see
Lua (1)
Http://www.tecgraf.puc-rio.br/lua/

Diagnosis
The error message must be self-described.

Author
L. H. de Figueiredo, R. ierusalimschy and W. Celes ([email protected])

----------------------------------------
Readme file of luac

This is the luac and Lua compiler.
Its help manuals include HTML files in the nroff and.../DOC directories.

Luac translates the Lua program into a binary file.
You can call lua_dofile in C or call dofile in Lua to load and execute the generated binary file.

The main advantages of pre-compiled blocks are: faster loading to prevent source code from being modified by users and offline error detection.

Luac can also be used to understand Lua virtual machines.

Some luac identifiable options are listed here:
-Execution Standard Input
-L list
-O file output file (default value: "luac. Out ")
-P only performs parsing.
-S strip debugging information
-T test code integrity
-V: display version information

Luac is also an example of how to use the internal components of Lua.

Finally, luac does not need to run the time code. stubs. c ensures that it is not linked to luac. This file also shows how to avoid link parser.

Lua4.0 compiler documentation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.