摘要: 在lua5.2及之前的版本中,所有的数值都以双精度浮点格式表示。从5.3版本开始,Lua为数值提供了俩种选择:integer的64位整型和被称为float的双精度浮点型。 >type(3) -->number >type(3.0) -->number 整型值和浮点型值的类型都是"number",所以 阅读全文
posted @ 2021-02-10 21:48 围墙外的世界 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Lua支持逻辑运算符: and or 和not。将boolean的类型false和nil当作假,而把其他值当作真(短路运算) >4 and 5 -->5 >nil an 13 -->13 >false and 22 -->false >0 or 5 >5 在Lua语言中,形如x=x or v的习惯写 阅读全文
posted @ 2021-02-10 21:32 围墙外的世界 阅读(751) 评论(0) 推荐(0) 编辑
摘要: 在lua语言中,全局变量无需声明即可使用,未经初始化的全局变量也不会发生错误,只是默认值为nil >b --nil 阅读全文
posted @ 2021-02-10 21:19 围墙外的世界 阅读(141) 评论(0) 推荐(0) 编辑