Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

luac(1) [netbsd man page]

LUAC(1) 						      General Commands Manual							   LUAC(1)

NAME
luac - Lua compiler SYNOPSIS
luac [ options ] [ filenames ] DESCRIPTION
luac is the Lua compiler. It translates programs written in the Lua programming language into binary files that can be later loaded and executed. The main advantages of precompiling chunks are: faster loading, protecting source code from accidental user changes, and off-line syntax checking. Pre-compiling does not imply faster execution because in Lua chunks are always compiled into bytecodes before being executed. luac simply allows those bytecodes to be saved in a file for later execution. Pre-compiled chunks are not necessarily smaller than the corresponding source. The main goal in pre-compiling is faster loading. The binary files created by luac are portable only among architectures with the same word size and byte order. luac produces a single output file containing the bytecodes for all source files given. By default, the output file is named luac.out, but you can change this with the -o option. In the command line, you can mix text files containing Lua source and binary files containing precompiled chunks. This is useful to com- bine several precompiled chunks, even from different (but compatible) platforms, into a single precompiled chunk. You can use '-' to indicate the standard input as a source file and '--' to signal the end of options (that is, all remaining arguments will be treated as files even if they start with '-'). The internal format of the binary files produced by luac is likely to change when a new version of Lua is released. So, save the source files of all Lua programs that you precompile. OPTIONS
Options must be separate. -l produce a listing of the compiled bytecode for Lua's virtual machine. Listing bytecodes is useful to learn about Lua's virtual machine. If no files are given, then luac loads luac.out and lists its contents. -o file output to file, instead of the default luac.out. (You can use '-' for standard output, but not on platforms that open standard out- put in text mode.) The output file may be a source file because all files are loaded before the output file is written. Be careful not to overwrite precious files. -p load files but do not generate any output file. Used mainly for syntax checking and for testing precompiled chunks: corrupted files will probably generate errors when loaded. Lua always performs a thorough integrity test on precompiled chunks. Bytecode 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.) If no files are given, then luac loads luac.out and tests its contents. No messages are displayed if the file passes the integrity test. -s strip debug information before writing the output file. This saves some space in very large chunks, but if errors occur when run- ning a stripped chunk, then the error messages may not contain the full information they usually do. For instance, line numbers and names of local variables are lost. -v show version information. FILES
luac.out default output file SEE ALSO
lua(1) http://www.lua.org/ DIAGNOSTICS
Error messages should be self explanatory. AUTHORS
L. H. de Figueiredo, R. Ierusalimschy and W. Celes $Date: 2010/10/31 11:16:49 $ LUAC(1)

Check Out this Related Man Page

LUA(1)							      General Commands Manual							    LUA(1)

NAME
lua - Lua interpreter SYNOPSIS
lua [ options ] [ script [ args ] ] DESCRIPTION
lua is the stand-alone Lua interpreter. It loads and executes Lua programs, either in textual source form or in precompiled binary form. (Precompiled binaries are output by luac, the Lua compiler.) lua can be used as a batch interpreter and also interactively. The given options (see below) are executed and then the Lua program in file script is loaded and executed. The given args are available to script as strings in a global table named arg. If these arguments contain spaces or other characters special to the shell, then they should be quoted (but note that the quotes will be removed by the shell). The arguments in arg start at 0, which contains the string `script'. The index of the last argument is stored in arg.n. The arguments given in the command line before script, including the name of the interpreter, are available in negative indices in arg. At the very start, before even handling the command line, lua executes the contents of the environment variable LUA_INIT, if it is defined. If the value of LUA_INIT is of the form `@filename', then filename is executed. Otherwise, the string is assumed to be a Lua statement and is executed. Options start with - and are described below. You can use -- to signal the end of options. If no arguments are given, then -v -i is assumed when the standard input is a terminal; otherwise, - is assumed. In interactive mode, lua prompts the user, reads lines from the standard input, and executes them as they are read. If a line does not contain a complete statement, then a secondary prompt is displayed and lines are read until a complete statement is formed or a syntax error is found. So, one way to interrupt the reading of an incomplete statement is to force a syntax error: adding a `;' in the middle of a statement is a sure way of forcing a syntax error (except inside multiline strings and comments; these must be closed explicitly). If a line starts with `=', then lua displays the values of all the expressions in the remainder of the line. The expressions must be separated by commas. The primary prompt is the value of the global variable _PROMPT, if this value is a string; otherwise, the default prompt is used. Similarly, the secondary prompt is the value of the global variable _PROMPT2. So, to change the prompts, set the corresponding variable to a string of your choice. You can do that after calling the interpreter or on the command line with _PROMPT='lua: ', for exam- ple. (Note the need for quotes, because the string contains a space.) The default prompts are ``> '' and ``>> ''. OPTIONS
- load and execute the standard input as a file, that is, not interactively, even when the standard input is a terminal. -e stat execute statement stat. You need to quote stat if it contains spaces, quotes, or other characters special to the shell. -i enter interactive mode after script is executed. -l file call require(file) before executing script. Typically used to load libraries (hence the letter l). -v show version information. -P suppress the creation of a standard LUA_PATH variable. Use this if you need to run scripts which conflict with system-installed libraries. SEE ALSO
luac(1) http://www.lua.org/ DIAGNOSTICS
Error messages should be self explanatory. AUTHORS
R. Ierusalimschy, L. H. de Figueiredo, and W. Celes <lua@tecgraf.puc-rio.br> Debian modifications to the manpage by Daniel Silverstone <dsilvers@debian.org> 2003/04/02 00:05:20 LUA(1)
Man Page