Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags


What does the luac compiler do in Lua?

Educative Answers Team

luac is the compiler for the Lua programming language. It converts Lua code into binary files that can be loaded and executed.

svg viewer

Precompiling may result in faster performance because it allows for faster loading. However, the actual execution is the same because all Lua chunks are always compiled to bytecode before they are executed. Precompiling also has the benefit of protecting the code source from user tampering (accidental or otherwise) and providing off-line syntax checking.

Binary files created by luac are only portable among architectures with the same word size and byte order.

In the command-line, you can mix text files with Lua source code and binary files containing precompiled chunks. This allows us to combine several precompiled chunks across platforms into a single precompiled chunk.

Be sure to keep source files because binary files are likely to change when a new version of Lua is released.


Options are entered separately.

Option Description
-l Produce a listing of compiled bytecode for Lua’s VM.
-o The output is a file, instead of the default luac.out.
-p Loads files but does not generate any output file. Used for syntax checking and testing precompiled chunks. Corrupt files should produce errors.
-s Strips debug information before writing the output file
-v Shows version information.

Visit the official documentation for more.


Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring