Build your own LUA development debugging environment based on the Cocos Code IDE

Source: Internet
Author: User

The basic model is now a route for C + + kernel + Lua logic, whether it's an end-of-tour or hand-tour (COCOS2D-based) development. For C + + development and debugging, VS has been able to meet the needs of developers, Microsoft is commendable. Unfortunately, the development and commissioning of LUA, there is not a unified, convenient development debugging environment, which also caused a great deal of luaer and projects. There are generally some of the following general practices:

1, the pure sense of the LUA editor, such as Sublime Text 2 + plug-in mode, solved the code hints and problems.

2, the editor based on the addition of debugging functions, usually directly on vs on the development of a corresponding plug-in (such as Babe Lua), or a separate third-party programs (such as Decoda, LUA Studio).

These scenarios basically have LUA debugging inconvenient, there is no unified rule to customize their Lua API, so how to build a good LUA development debugging environment is very important for the project.

The author because of the Code hints, completion, how to debug Lua, plug-in development principles do not understand, and do not have the energy to study this aspect of the content, think of a lazy approach, but also considering the current cocos2d development of good trends, Why not build your own LUA development and debugging environment directly from the development of LUA in the COCOS2D environment. In the COCOS2D environment, developers typically use the Cocos code IDE to write and debug Lua. The Cocos code IDE is Eclipse-based (Eclipse is really powerful and can be customized as needed, including Adobe's Flash builder based on this set of environments), which better solves the problem of editing LUA code, such as tips, completion, etc. If you are debugging LUA code, you need to specify a standalone program that can be called a third-party EXE, which is actually a C + + kernel program, the LUA host program, used to explain the execution of LUA code. As for this host program, you can use cocos2d pre-provided PrebuiltRuntimeLua.exe, or you can use the template provided by cocos2d to build your own unique hosting program. How does this host program interact with the Cocos Code IDE (where the interaction refers to C + + code that can debug the host program under VS and Debug Lua in the Cocos Code IDE), the author simply tracks the run of the host program, whether it's local debugging or remote debugging, The approximate principles and procedures are as follows:

1. The host program starts, displays the wait window, and turns on the socket monitor (which is not very good, meaning that it can be debugged remotely) wait for the Cocos code IDE to connect and instruct.

2, Cocos Code IDE Start, connect socket, send instruction to host program.

3, the Host program analysis instructions, if it is sendrequest this instruction, then executes a LUA portal script (Src\main.lua, can be customized in the program), C + + and LUA to formally start the birds.

As for how the Cocos code IDE implements LUA code editing-related and debugging-related functions on an eclipse basis, the author does not understand, and basically does not take the time to study. I want to do is based on the above analysis of the principles, on the basis of Cocos Code IDE to customize their own LUA development debugging environment.

The advantages of this scheme are based on a good foundation, can be more convenient and rapid implementation. Due to the good trends and extensive application of cocos2d development, I believe the cocos2d development team will continuously strengthen and perfect the Cocos code IDE's functions. Therefore, it can be said that a relatively strong team behind this package.

So how to implement this scheme, the author believes that there are several issues to be solved:

1, how to let the Cocos code IDE to recognize the custom host program.

2. How to define your own LUA API to make the Cocos code IDE recognizable.

Customizing the Host Program

This can refer to a runtime project for a LUA project created with a cocos2d module, or a player project in quick Cocos.

Define your own LUA API

This problem can be subdivided into two areas:

1. APIs in LUA scripts

The Cocos code IDE natively supports the IDE's ability to recognize the API defined in the IDE, as long as it is a LUA script that can be retrieved.

2. C + + registered to the API in Lua

This can refer to how the Cocos code IDE identifies the API in the LUA library, the Cocos2d library, and the Quick Cocos Library.

Additions and Visions:

1, the debugging principle of Lua.

2, vs plug-in development principle (how to implement LUA development debugging directly in the VS environment).

3. How to implement the code editing function and debugging function of a language in eclipse.

3. Microsoft may one day consider Lua as the official script for C + +, which integrates Lua's development and debugging capabilities directly in VS, a boon for the vast luaer.

Build your own LUA development debugging environment on the basis of the Cocos Code IDE

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.