Learning Lua programming (3) build the best coding environment for Lua scripts under iMac (Code Completion, compilation and running)

Source: Internet
Author: User
Tags sublime text editor

Refer to the self-built.


This article records how to build the best coding environment for Lua scripts in the MAC system environment with powerful Code Completion and compilation and running.

The sublime text editor is used here. The following describes in detail:

(1) download sublime text

Note that the version is 2.0.2 and sublime text 2.


(2) install the Lua environment (the latest version is used here: 5.2.1)

On this page, click the link to install Lua. on this page, two installation methods are prompted:

① The first method is to use rudix (if it is not installed, click the open link to install it on the command line terminal.
Rudix) install the Lua environment on the command line terminal: sudo rudix install Lua.
However, it is troublesome because I need to use the root permission during the rudix installation process (in actual operation, I have never obtained the root permission, which is a personal technical problem ),

Therefore, it is not recommended.

② Download the PKG installation package directly and double-click it to install it.



(3) Open sublime text 2 and call up the terminal console. (The operation steps are as follows :)


Copy and paste all the following code once, as shown in the command line, and press Enter.

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'


Under normal circumstances, the terminal will prompt: Please restart sublime text to finish installation. Then you need to restart sublime text2!


(4)After restarting sublime text2,Command + Shift + P
Call up the plug-in configuration, enter instal and press enter to display the list of plug-ins that can be downloaded. Then enter Lua, click to download plug-ins related to Lua and cocos2d-x to download.
(Note the prompt message in the lower left corner during installation !)


(5) set Lua compilation path for sublime text

The following two methods are described:

① After Lua is installed, enter which Lua in the terminal to display the installation path of Lua. The default value is:/Usr/local/bin/Lua

Go to the folder:Resource Library/Application Support/sublime text 2/packages/Lua DEV/Lua. sublime-build



Find the Lua. sublime-Build File, open it in a text editor, and modify the content as follows:

{"cmd": ["/usr/local/bin/lua", "$file"],"file_regex": "^(?:(?:\t)|(?:.+: ))(.+):([0-9]+): (.*)$","selector": "source.lua"}

Save it.


② There is another method below:

Environment setting. py: Click the open link to download the file and paste it to the following path: Resource Library/Application Support/sublime text 2/packages/user/
(6) Now, a powerful Lua editing environment is ready. Enjoy it, code prompts, compilation and running, haha!



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.