Lua source code reading 1-compile in Windows

Source: Internet
Author: User

I feel that I have no idea about it recently. Let's take a look at the Lua source code and pass the time.

First, download and compile the Lua source code.

 

1. first, you need to download the Lua source code from the official website and download the Lua source code from www.lua.org. The latest version is 5.1 rc420.lua-5.1.4.tar.gz. After decompression, the directory contains the install file, this file details the compilation process in Linux, and the compilation in Visual Studio also mentions

2. Compile lualib

Create a VC ++ console project lualib, "ApplicationProgramSet "---> static library to generate the default. H ,. CPP deletion. Do not use the pre-compiled header when setting it, right-click the lualib project --> Add ---> Add existing items --> Add the following files in the src directory under the decompressed Lua source code directory (the following file lists are described in install ):

Library: lapi. c lcode. c ldebug. c ldump. c lfunc. c lgc. c llex. c
Lmem. c lobject. c lopcodes. c lparser. c lstate. c lstring. c
Ltable. c ltm. c lundump. c LVM. c lzio. c
Lauxlib. c lbaselib. c ldblib. c liolib. c lmathlib. c loslib. c
Ltablib. c lstrlib. c loadlib. c linit. c

After compilation, A lualib. Lib file is generated;

 

3. Compile the luac Compiler

Create a VC ++ console project luac, which is generated by default. H ,. CPP Delete, set it to not use the pre-compiled header, right-click the luac project ---> Add existing items ---> prepare;

 

4. Compile the Lua interpreter

Create a VC ++ console project Lua and set the default value. H ,. delete CPP, set it to do not use the pre-compiled header, right-click the Lua project ---> Add existing items ---> decompress the Lua source code directory in the src directory. h, lua.c, right-click Project dependency, and lualib,compile and generate lua.exe;

 

5.double-hitting lua.exe runs the Lua interpreter. You can enter LuaCodeExecuted:

 

6. debug Lua

In Lua. the main function in the C file has a breakpoint. If you want to run the Lua code in the interpreter, it will be broken. the loadline function of C has a breakpoint and will be called to the load_string function in lualib.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.