lua安装

lua安装

1.Lua介绍

特点:轻量、小巧。C语言开发。开源。

设计的目的:嵌入到应用程序当中,提供灵活的扩展和定制化的功能。

lua+nginx,lua+redis。

2.windows安装lua

windows上安装lua:

检查机器上是否有lua

shell 复制代码
C:\Users\asus>lua
'lua' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Users\asus>

打开官网:https://lua.org/

点击下载:

得到文件:LuaForWindows_v5.1.5-52.exe

双击,一直下一步。

验证安装结果:

3.linux安装lua

打开官网:https://lua.org/

步骤:

shell 复制代码
curl -R -O http://www.lua.org/ftp/lua-5.4.6.tar.gz
tar zxf lua-5.4.6.tar.gz
cd lua-5.4.6
make all test
make install
lua -v 

检查是否安装成功

shell 复制代码
[root@localhost lua-5.4.6]# lua -v
Lua 5.4.6  Copyright (C) 1994-2023 Lua.org, PUC-Rio
[root@localhost lua-5.4.6]# cd /usr/local/bin/
[root@localhost bin]# ./lua -v
Lua 5.4.6  Copyright (C) 1994-2023 Lua.org, PUC-Rio
[root@localhost bin]# 

4.编程方式

交互式:
linux

shell 复制代码
[root@localhost bin]# lua
Lua 5.4.6  Copyright (C) 1994-2023 Lua.org, PUC-Rio
> print("hello")        
hello

windows

shell 复制代码
C:\Users\asus>lua
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> print('hello lua')
hello lua
>

脚本式:

linux

shell 复制代码
[root@localhost lua-script]# pwd
/lua/lua-script
[root@localhost lua-script]# vi hello.lua
# hello.lua 填写内容如下 print('hello')
[root@localhost lua-script]# lua hello.lua
hello

windows

shell 复制代码
D:\lua>lua hello.lua
script lua win
相关推荐
郑州光合科技余经理9 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
feifeigo1239 天前
matlab画图工具
开发语言·matlab
dustcell.9 天前
haproxy七层代理
java·开发语言·前端
norlan_jame9 天前
C-PHY与D-PHY差异
c语言·开发语言
多恩Stone9 天前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系
开发语言·c++·人工智能·python·算法·3d·aigc
QQ4022054969 天前
Python+django+vue3预制菜半成品配菜平台
开发语言·python·django
遥遥江上月9 天前
Node.js + Stagehand + Python 部署
开发语言·python·node.js
m0_531237179 天前
C语言-数组练习进阶
c语言·开发语言·算法
Railshiqian9 天前
给android源码下的模拟器添加两个后排屏的修改
android·开发语言·javascript
雪人不是菜鸡9 天前
简单工厂模式
开发语言·算法·c#