首先下载Lua,可在终端下用命令:brew install lua (这里需先安装brew);
然后下载安装Sublime Text 2,打开tools -> Build System -> New Build System,在编辑区输入:
1
2
3
4
5
|
{ "cmd" : [ "/usr/local/bin/lua" , "$file" ],
"file_regex" : "^(...*?):([0-9]*):?([0-9]*)" ,
"selector" : "source.lua"
} |
然后保存为 LuaBuild.sublime-build。关闭,重新打开,新建文件test.lua ,输入print("Jacedy"),按command + B 就可以编译了。
接下来安装Package Control插件。打开Sublime text,按Ctrl + ` 调出命令行,输入:
1
|
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'
|
回车直接安装完成。可通过command+shift+P 可调出插件,输入install 后可下载自己所需的插件,可输入lua 等下载Lua相关插件,例如:Lua Dev