LDT进阶篇(3)--Boolean类型解析
1、创建一个name为BooleanStudy的lua脚本
脚本内容:
--true
if true then
print("true,execute print")
end

2、点击LDT工具栏上的bug(小甲虫)按钮右侧第一个 绿色三角 按钮来运行Lua脚本

3、执行结果:
true,execute print

4、脚本内容:
--false
if false then
print("execute print when false")
end

5、执行结果:没有输出。
当条件为false时,打印语句不会执行

6、脚本内容:
--数字0
if 0 then
print("execute print when 0")
end

7、执行结果:
execute print when 0

8、Lua中if条件为数字1时,即为true,打印语句会执行。
脚本内容:
--数字1
if 1 then
print("execute print when 1")
end
执行结果:
execute print when 1

9、Lua中if条件为nil时,即为false,打印语句不会执行
脚本内容:
--nil
if nil then
print("execute print when nil")
end
执行结果:没有输出。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:172
阅读量:44
阅读量:135
阅读量:21
阅读量:104