First, the installation of Lua prefers to download the source code compilation directly from the official website rather than from the Ubuntu source. One is that the official version is not the latest, the other is that the lua installed on the source does not know how to plug the various folders into several scattered places, which is very troublesome to find. On www.lua.org you can download the source code: http://www.lua.or
First, install Lua.
I personally prefer to download the source code compilation directly from the official website instead of the Ubuntu source. One is that the official version is not the latest, the other is that the lua installed on the source does not know how to plug the various folders into several scattered places, which is very troublesome to find.
You can download the source code at www.lua.org: http://www.lua.org/ftp /. Theoretically, after decompression, go to the src/folder and run make linux install. But in fact, you will find that you have another package, and use this command to install: sudo apt-get install libreadline5.
You can also directly download the compiled Binary Package from lua and copy it to the corresponding directory according to the instructions on the website.
Version Problems
The Lua version is easy to worry about. Compared with version 5.1, Lua 5.0 exaggerated the change of several important function names, while online tutorials and examples basically follow 5.0, you will receive a one-click error during compilation. You can refer to "Incompatibilities with the Previous Version" in the last part of the lua source code package doc/manual.html.
What is abnormal is that it is difficult to find other information about version 5.1 Except manual. The only official version of programming in lua, which is based on version 5.1, but they can only be ordered in Amazon bookstore. Although the first version is free of charge, it is indeed based on 5.0. People suspect that they are planning to use this method to sell books and earn money.
C Compilation
When compiling the C/C ++ program that interacts with Lua, do not forget to link the corresponding Library: add the parameter-llua-ldl in the gcc command.