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-RioOK ,已经安装成功!

二、使用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来编译脚本了。

  1. 使用Sublime编写Lua代码
    lua的编辑和运行环境已经搭建好了新建一个hello.lua文件,随便写个语句,选择lua为build system,按一下Command+B,就能跑出来了。MAC 上搭建lua - Sylar_Lin - 低调做人高调做事原文链接: https://www.cnblogs.com/yeahwell/p/4775018.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/221430

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月13日 上午11:16
下一篇 2023年2月13日 上午11:17

相关推荐