Why come lua2.4?
Because lua2.4 adds an external compiler luac, You can compile the Lua script into bytecode. The interpreter can directly execute the compiled bytecode, improving the loading speed. Here we mainly want to see how the compiler saves the generated bytecode, so let's take a look at this version.
Lua2.4 code: www.lua.org/ftp/lua-2.4.tar.gz
After the code is downloaded, make in mingw, many errors. If you haven't written makefile for a long time, you still need to worry about it. You don't need to compile it with mingw. You can directly use vs2010. Start vs2010 and build the project. For the luac compiler and the Lua interpreter, build the projects respectively, and compile Lua and luac smoothly. Because Lua is written in ansi c, there is no problem in cross-platform programming.
The error c2099: initializer is not a constant occurs again during compilation. The modification method is the same as before, as shown below:
---------------------------------------------------------
Line 19 of iolib. c
Static file * In = stdin, * out = stdout;
Change
Static file * In = NULL, * out = NULL;
In iolib_open, assign values to In and out:
In = stdin; out = stdout;
---------------------------------------------------------
The files used by the two projects are as follows.
Luac: All in the src directory and all in the include directory.
Lua: In the src directory (except in the luac directory), include all in the directory, and all in the clients directory.
Create an empty Win32 command line program during project creation. You can simply create a code directory and copy all the files in the directory mentioned above. Add an existing file to the project and add all the files in the Code directory.
After compiling in Linux and modifying the previous error in iolib. C, make went smoothly.
Indeed, Linux is a standard platform in the open-source world. This is why you find that many open-source software is not available or is not useful in windowns, because the software was developed in Linux at the beginning, it was only after discovering that there were too many users to be transplanted to windows, so there were all kinds of unhappiness. Of course, this is another issue. We will not discuss it here.
Lua2.4 preparations