Note: The following is a text-only compilation and Hello Lua process that is based on someone else's tutorials or notes and is recorded in accordance with your own actions.
Original Version Link: original link
1. Create an empty solution:
Other project types, new project, file-----Blank solution,->visual Studio Solution
Name: Lua53
Position:..
Next, create 3 projects in this solution: Luz_lib, Lua, and Luac, respectively.
The LUA and LUAC projects will generate the execution files we need in the end. Lua_lib will generate a static library file,
This library file is required for the compilation of Lua and LUAC projects. So we need to compile the Lua_lib project first and generate the required library files.
2. Create a Lib Static library:
A. On the Lua53 solution, right-click Add-New Project->visual C + +, empty project
Name: Lua_lib
Location: ...
B. On the Lua_lib project, right-click Add, existing item (or already existing item),
Open Lua Extract directory, locate the SRC folder, select All files, and then exclude LUA.C and
LUAC.C two files, add all other files to the Project Central.
(The library files that we need are generated in the Ps:lua_lib project, and LUA.C and LUAC.C are used in the Lua project
and the Luac project, respectively.)
C. Compile the Lua_lib project, first you need to modify the project configuration, on the Lua_lib project, right-click Properties, Configuration Properties, General
, configure type select Static library (. lib), and then select the project, Click Test-and-debug in the main menu bar and after all the tests have run, a debug folder will appear in the
Solution folder with a Lua_lib.lib file, which is the library file required by LUA and LUAC.
3. Continue to create the remaining items: Lua, Luac
A. Create a new empty project Lua and Luac by right-clicking on the Lua53 solution, as with the Lib project creation
B. Add LUA.C to the LUA project, LUAC.C add to the LUAC project.
C. Next, perform the same operations on the LUA and LUAC projects, and map the required lua_lib.lib library files:
Right-click Lua Project, Properties------Add dependency selection, type
Input lua_lib.lib OK, pull-and edit. In this pop-up window, select the linker--general--Additional library directory, dropdown, edit, click folder button
, add the directory of the Lua_lib.lib library file, and then OK. (Example: D:\visual studio 2013\projects\lua53\debug)
4. Generate the executable file:
Compile the solution (main menu-Test-debug-all tests). After success, the Lua.exe and Luac.exe are generated in the debug directory of the solution.
Executable files are the files we need.
5. Test the compiled file:
Open the console to switch directories to the Debug folder of the Lua53 solution, enter Lua.exe on the console to enter the LUA handler, and enter
Displays the current version information, and so on.
Then enter print ("Hello lua"), enter if you see the printed Hello Lua. is successful.
You can also create a new test script (. lua file) under the current directory. Enter print ("Hello Lua") in the file and save it.
The hello Lua output should then be visible in the console access Lua.exe Test.lua.
Luac.exe similar to a compiler, the. lua file is processed as a binary file of. Out. You can then execute it with Lua.exe.
When you enter Luac.exe Test.lua in the console, the Luac.out file is generated in the current directory, and then Lua.exe Luac.out will see the same
Hello Lua output.
Compiling Lua5.3.1 in Visual Studio 2013