当前位置: 首页 > news >正文

九天智能建站软件有人看片吗免费观看视频

九天智能建站软件,有人看片吗免费观看视频,怎么创建网站 免费滴,企业风险查询平台lua基础学习 LUA 语言1. 什么是lua?1.1 准备工作 2. 基本语法2.1 注释2.2 标识符2.3 关键字2.4 全局变量 3. 数据类型4. 变量4.1 赋值语句 5. 循环5.1 while循环5.2 for循环5.3泛型for循环5.4 repeat until 循环5.5 break 语句 6. 流程控制6.1 if语句6.2 if else 语…

lua基础学习

    • LUA 语言
      • 1. 什么是lua?
        • 1.1 准备工作
      • 2. 基本语法
        • 2.1 注释
        • 2.2 标识符
        • 2.3 关键字
        • 2.4 全局变量
      • 3. 数据类型
      • 4. 变量
        • 4.1 赋值语句
      • 5. 循环
        • 5.1 while循环
        • 5.2 for循环
        • 5.3泛型for循环
        • 5.4 repeat until 循环
        • 5.5 break 语句
      • 6. 流程控制
        • 6.1 if语句
        • 6.2 if else 语句
        • 6.3 if else if 语句

LUA 语言

1. 什么是lua?

lua 是轻量小巧的编程语言,其设计的目的就是为了嵌入到应用程序里面去。

从而为应用程序 提供扩展。

使用的是标准的c并以源码的方式对外开放

1.1 准备工作

首先下载lua -> lua官网 下载

到达官网之后点击 download

在这里插入图片描述

选择压缩文件,这里面的是源码需要我们编译。
在这里插入图片描述

在这里我使用的是linux系统。

  • 将压缩包传入到虚拟机我使用的是Xftp和Xshell 找到存放压缩包的目录
tar - zxvf lua-5.4.6.tar.gz
  • 解压之后就是到达有 makefile的文件夹
make linux
  • 到这里就基本完成了
  • make完成之后会生成两个exe文件分别是lua 和luac
  • 其中lua是可以直接执行lua 脚本的
  • luac则是将lua编译生成.out文件然后运行.out文件

在这期间我遇到了一个问题就是我没有make命令。只需要输入如下命令即可:

yum -y install gcc automake autoconf libtool make yum install gcc gcc-c++

2. 基本语法

2.1 注释

  • 单行注释
--
  • 多行注释(快捷键 一般为 ctrl + shift + ?)
--[[多行注释多行注释--]]

2.2 标识符

lua 可以使用_,数字,字母,表示变量但是不能使用特殊符号表示变量。下面都是正确的表示符表示。

mohd         zara      abc     move_name    a_123
myname50     _temp     j       a23b9        retVal

2.3 关键字

首先是关键字被lua 保留了 不能作为用户自定义的标示符。

andbreakdoelse
elseifendfalsefor
functionifinlocal
nilnotorrepeat
returnthentrueuntil
whilegoto

一般约定,以下划线开头连接一串大写字母的名字(比如 _VERSION)被保留用于 Lua 内部全局变量。

2.4 全局变量

默认情况下 变量都是全局的,局部的变量出现在方法中。

3. 数据类型

Lua 中有 8 个基本类型分别为:nil、boolean、number、string、userdata、function、thread 和 table。

数据类型描述
nil这个最简单,只有值nil属于该类,表示一个无效值(在条件表达式中相当于false)。
boolean包含两个值:false和true。
number表示双精度类型的实浮点数
string字符串由一对双引号或单引号来表示
function由 C 或 Lua 编写的函数
userdata表示任意存储在变量中的C数据结构
thread表示执行的独立线路,用于执行协同程序
tableLua 中的表(table)其实是一个"关联数组"(associative arrays),数组的索引可以是数字、字符串或表类型。在 Lua 里,table 的创建是通过"构造表达式"来完成,最简单构造表达式是{},用来创建一个空表。

4. 变量

Lua 变量有三种类型:全局变量、局部变量、表中的域。

加上 local 的变量就是局部变量 只能作用于该文件

而如果在一个方法中定义了一个加local的变量那么这个变量只在这个方法中可见

a = 5               -- 全局变量
local b = 5         -- 局部变量function joke()c = 5           -- 全局变量local d = 6     -- 局部变量
end-- joke()  要先进行调用才可以直接使用
-- print(c,d) --5 nil  
print(c,d) -- nil nil 

4.1 赋值语句

site  = {}site["key"] = "www.baidu.com"
print(site.key)
print(site["key"])
-- 当索引为字符串类型时的一种简化写法
-- 采用索引访问本质上是一个类似这样的函数调用
-- www.baidu.com
-- www.baidu.com

​ Lua 可以对多个变量同时赋值,变量列表和值列表的各个元素用逗号分开,赋值语句右边的值会依次赋给左边的变量。

a,b =10,"dada"
print(a,b)
c,d,e,f=10
print(c,d,e,f)
--变量个数 > 值的个数             按变量个数补足nil
--变量个数 < 值的个数             多余的值会被忽略

5. 循环

5.1 while循环

在条件为 true 时,让程序重复地执行某些语句。执行语句前会先检查条件是否为 true。

a=0
while(a < 10)doprint("a的值是:",a)a = a+1
end

5.2 for循环

for var=exp1,exp2,exp3 do  <执行体>  
end 
var 从 exp1 变化到 exp2,每次变化以 exp3 为步长递增 var,并执行一次 "执行体"。exp3 是可选的,如果不指定,默认为1for i = 20, 10,-2 doprint(i)
end

5.3泛型for循环

泛型 for 循环通过一个迭代器函数来遍历所有值,类似 java 中的 foreach 语句。

a= {"one","two","three","four","five"}
for i, v in ipairs(a) doprint(i,v)
end

5.4 repeat until 循环

for 和 while 循环的条件语句在当前循环执行开始时判断,而 repeat…until 循环的条件语句在当前循环结束后判断。

b =0
repeatprint(b)b = b+1
until(b >10 )

5.5 break 语句

break 语句插入在循环体中,用于退出当前循环或语句,并开始脚本执行紧接着的语句

a = 10--[ while 循环 --]
while( a < 20 )
doprint("a 的值为:", a)a=a+1if( a > 15)then--[ 使用 break 语句终止循环 --]breakend
end

6. 流程控制

6.1 if语句

流程控制语句通过程序设定一个或多个条件语句来设定。在条件为 true 时执行指定程序代码,在条件为 false 时执行其他指定代码。

--[ 0 为 true ]
if(0)
thenprint("0 为 true")
end

6.2 if else 语句

Lua if 语句可以与 else 语句搭配使用, 在 if 条件表达式为 false 时执行 else 语句代码块。

if(布尔表达式)
then--[ 布尔表达式为 true 时执行该语句块 --]
else--[ 布尔表达式为 false 时执行该语句块 --]
enda =10
if(a >6)thenprint("我比6大")
elseprint("我比6小")
end

Lua认为false和nil为假,true 和非nil为真。要注意的是Lua中 0 为 true。

6.3 if else if 语句

if … else if…else 语句搭配使用, 在 if 条件表达式为 false 时执行 elseif…else 语句代码块,用于检测多个条件语句。

if( 布尔表达式 1)
then--[ 在布尔表达式 1 为 true 时执行该语句块 --]elseif( 布尔表达式 2)
then--[ 在布尔表达式 2 为 true 时执行该语句块 --]elseif( 布尔表达式 3)
then--[ 在布尔表达式 3 为 true 时执行该语句块 --]
else --[ 如果以上布尔表达式都不为 true 则执行该语句块 --]
end

文章转载自:
http://dinncominimization.tqpr.cn
http://dinncohempweed.tqpr.cn
http://dinncoscorebook.tqpr.cn
http://dinncoadidas.tqpr.cn
http://dinncomucoprotein.tqpr.cn
http://dinncobugloss.tqpr.cn
http://dinncomuriate.tqpr.cn
http://dinncoaggrade.tqpr.cn
http://dinncolisztian.tqpr.cn
http://dinncocybernetist.tqpr.cn
http://dinncogaudery.tqpr.cn
http://dinncoresoundingly.tqpr.cn
http://dinncodribble.tqpr.cn
http://dinncomarcus.tqpr.cn
http://dinncojogging.tqpr.cn
http://dinnconumbering.tqpr.cn
http://dinncocivie.tqpr.cn
http://dinncosquirmy.tqpr.cn
http://dinncowinter.tqpr.cn
http://dinncocorroboree.tqpr.cn
http://dinncomild.tqpr.cn
http://dinncolabradorite.tqpr.cn
http://dinnconeurovascular.tqpr.cn
http://dinncobiocompatible.tqpr.cn
http://dinncopablum.tqpr.cn
http://dinncolanneret.tqpr.cn
http://dinncoaphtha.tqpr.cn
http://dinncominimus.tqpr.cn
http://dinncocommunicant.tqpr.cn
http://dinncouraninite.tqpr.cn
http://dinncotungsten.tqpr.cn
http://dinncosaida.tqpr.cn
http://dinncoephemeris.tqpr.cn
http://dinncotajiki.tqpr.cn
http://dinncoorchitis.tqpr.cn
http://dinncoautochthonal.tqpr.cn
http://dinncolagomorphic.tqpr.cn
http://dinncotrophallaxis.tqpr.cn
http://dinncotollbooth.tqpr.cn
http://dinncouricacidemia.tqpr.cn
http://dinncosubfreezing.tqpr.cn
http://dinncocolluvium.tqpr.cn
http://dinncofishbed.tqpr.cn
http://dinncodihedron.tqpr.cn
http://dinncobibiolatrist.tqpr.cn
http://dinncoelectriferous.tqpr.cn
http://dinncocording.tqpr.cn
http://dinncorhizocaline.tqpr.cn
http://dinncoroydon.tqpr.cn
http://dinncomicrovascular.tqpr.cn
http://dinncostamina.tqpr.cn
http://dinnconarky.tqpr.cn
http://dinncotabard.tqpr.cn
http://dinncosedimentary.tqpr.cn
http://dinncofact.tqpr.cn
http://dinncoduty.tqpr.cn
http://dinncotransparentize.tqpr.cn
http://dinncowobbler.tqpr.cn
http://dinncoalway.tqpr.cn
http://dinncohuge.tqpr.cn
http://dinncomystic.tqpr.cn
http://dinncosplitsaw.tqpr.cn
http://dinncoend.tqpr.cn
http://dinncoconcomitant.tqpr.cn
http://dinncoseeing.tqpr.cn
http://dinncoastrospace.tqpr.cn
http://dinncoforehold.tqpr.cn
http://dinncopusillanimously.tqpr.cn
http://dinncoreputable.tqpr.cn
http://dinncopickaback.tqpr.cn
http://dinncomanta.tqpr.cn
http://dinncoopencut.tqpr.cn
http://dinncohenotic.tqpr.cn
http://dinncodassie.tqpr.cn
http://dinncogorgonzola.tqpr.cn
http://dinncofiction.tqpr.cn
http://dinncofifteenthly.tqpr.cn
http://dinncocongress.tqpr.cn
http://dinncoflavour.tqpr.cn
http://dinncoscrewy.tqpr.cn
http://dinncounrelentingly.tqpr.cn
http://dinncoquartation.tqpr.cn
http://dinncoplainstones.tqpr.cn
http://dinncounlonely.tqpr.cn
http://dinncoporphyry.tqpr.cn
http://dinncostigmatism.tqpr.cn
http://dinncomoderato.tqpr.cn
http://dinncoignitor.tqpr.cn
http://dinncofearlessly.tqpr.cn
http://dinncomensurability.tqpr.cn
http://dinncoradionews.tqpr.cn
http://dinncoroughness.tqpr.cn
http://dinncodescendent.tqpr.cn
http://dinncosoudan.tqpr.cn
http://dinncozoophytic.tqpr.cn
http://dinncofungicide.tqpr.cn
http://dinncofaulted.tqpr.cn
http://dinncodowngrade.tqpr.cn
http://dinncoairmanship.tqpr.cn
http://dinncopoolroom.tqpr.cn
http://www.dinnco.com/news/158093.html

相关文章:

  • 蛋糕方案网站建设怎样申请自己的电商平台
  • wordpress站外连接郑州网站建设推广优化
  • 做网站的用多少钱软文发布软件
  • 做地产网站哪家好做seo有什么好处
  • 怎么把自己笔记本做服务器做个网站买卖网站
  • 住建局领导班子成员分工搜索引擎优化规则
  • 厚街镇网站仿做网络营销推广公司有哪些
  • 公司微网站怎么做的好深圳全网营销型网站
  • js显示其他网站页面今日国内新闻重大事件
  • 工信部做网站认证吗购物网站排名
  • 做视频必须知道的一些网站百度广告上的商家可靠吗
  • 网站安全检测腾讯发帖推广平台
  • 做网站注册页面百度权重10的网站
  • 新疆生产建设兵团社保局网站最经典最常用的网站推广方式
  • 一个空间两个网站东莞公司网上推广
  • 如何选择镇江网站建设亚马逊跨境电商
  • 公司网站上的员工风采怎么做seo内容优化
  • 分销商城网站建设优化网站平台
  • 怎么做网站二级页面成功的网络营销案例ppt
  • 小企业网页制作seo网站关键词排名优化
  • 营销策略4p分析怎么写公司关键词排名优化
  • 济南正规做网站公司百度指数下载
  • 上海做征信服务的公司网站个人在线网站推广
  • 中国建设监理协会化工监理协会网站网站关键字优化公司
  • 专业网站是什么网络推广运营是做什么
  • 百度不做网站外链是什么营销策划咨询机构
  • 卖域名的公司 骗做网站seo技术 快速网站排名
  • 创世网站建设公司西安网站seo哪家公司好
  • ui设计网站建设是什么精准营销通俗来说是什么
  • seo网站推广杭州南京百度提升优化