Debug Lua in cocos2d-x

Source: Internet
Author: User

The cocos2d-x Development Kit has built-in Lua, and also has built-in tolua ++, provides Lua support for C ++. The sample in the Development Kit downloaded on the official website contains

Lua instance. How to debug Lua in the projectCodeWhat about it? Today's topic is debugging Lua code in cocos2d-x.

 

There are two tools available, one simple point and one complex point.

1. decoda)

2. luaedit (Open Source)

I don't mean to evaluate the two debug tools, but to use them in a difficult way.

 

Let's talk about the simple and easy operation method first. This does not need to be changed to the Code (decoda)

I compiled the hellolua sample on the window, and the tool is vs2010. debug mode compilation. You don't need to talk about it. The generated file is in debug. Win32.

Directory, and contains a lot of linked library files.

 

Start decoda, select start debugging [F5] In the debug option, and select the absolute path of the file where debug is executed in the commad option.

Debug is started below, but an error is prompted:

Very clear, output in the background of the cocos2d-x, prompting us not to find the hello. Lua file. Of course, also cannot find hello2.lua file.

This is because of the path problem. I didn't configure vs. As a result, the file generated after compilation is not in the folder of the current project. Therefore, if the Lua file cannot be found, it will go to hellolua sample.

Under the folder, copy all the files in the resource folder to the current directory. Then run debug to view the game screen. Check the current background output.

The information is normal, which needs to be confirmed.

 

Note that no breakpoint has been inserted, so disable the current debug, and then insert the breakpoint in The Lua file, and then repeat the previous operation to implement debug.

I just added a watch target on a hypothetical basis. You can see the result.

 

In the decoda file package, there are user documents, e-files, simple tutorials. decoda has two usage methods, and I just briefly introduced the injection to the host.ProgramThe attack method is not introduced.

For more information about the host process, see the documentation.

 

2. The complex method is to use luaedit for debugging. luaedit provides the remote debug mode, but you need to enable remote debugger on the host during debugging.

Luaedit provides files and libraries required for programming, which must be documented on the official website.

Sorry, you don't need to translate this. Everyone can understand it.

 

So many of them are debug methods on windows, but these software cannot be used on Linux.

Software. You can't do it yourself.

 

 

 

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.