Compiling the Lua source code
There are many ways to access the Lua language. If you are using Linux, you can install Lua for development with the distribution’s package manager. For Windows, you can also find prebuilt binaries. However, since our goal is to integrate Lua into your C++ project, instead of using it as a standalone interpreter, it’s best to build from the source code yourself. When studying Lua, this will help you learn more about Lua. For example, in a modern code editor, Visual Studio Code included, you can easily check the declaration and implementation of Lua library functions.
In this section, we will focus on compiling Lua from its source code. Unarchive the downloaded Lua source code archive. Most compression tools support this, and the Lua download site also gives instructions. When you have done this, you will see a simple folder structure:
lua-5.4.6 % ls Makefile README doc src
We will learn what the preceding code block does in the next...