MAC 上搭建lua環境


一、下載並安裝

(1)最新release版下載地址

http://www.lua.org/ftp/lua-5.3.1.tar.gz

(2)編譯

Building

Lua is implemented in pure ANSI C and compiles unmodified in all platforms that have an ANSI C compiler. Lua also compiles cleanly as C++.

Lua is very easy to build and install. There are detailed instructions in the package but here is a simple terminal session that downloads the current release of Lua and builds it in Linux:

curl -R -O http://www.lua.org/ftp/lua-5.3.1.tar.gz
tar zxf lua-5.3.1.tar.gz
cd lua-5.3.1
make linux test

For Mac OS X, use make macosx test.

正常情況下會出現: src/lua -v

(3)安裝

然后再輸入“sudo make install”命令,會要求輸入Password:     輸入相應密碼(你的密碼),然后回車就自動安裝了
待安裝完成后可輸入 lua -v,回車就會看到 :
Lua 5.3.1  Copyright (C) 1994-2015 Lua.org, PUC-Rio
OK ,已經安裝成功!

 

二、使用IDE

1. 安裝Sublime

2. 安裝Lua編譯器

Tools->Build System->New Build System

輸入:

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

保存為Lua.sublime-build,然后Tools-Build System上就能選擇lua來編譯腳本了。

3. 使用Sublime編寫Lua代碼

lua的編輯和運行環境已經搭建好了
新建一個hello.lua文件,隨便寫個語句,選擇lua為build system,按一下Command+B,就能跑出來了。
MAC 上搭建lua - Sylar_Lin - 低調做人高調做事
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM