1、创建一个name为BooleanStudy的lua脚本脚本内容:--trueif true then print("true,execute print")end
2、点击LDT工具栏上的bug(小甲虫)按钮右侧第一个绿色三角按钮来运行Lua脚本
3、执行结果:true,execute print
4、脚本内容:--falseif false then print("execute print when false")end
5、执行结果:没有输出。当条件为false时,打印语句不会执行
6、脚本内容:--数字0if 0 then print("execute print when 0")end
7、执行结果:execute print when 0
8、Lua中if条件为数字1时,即为true,打印语句会执行。耔阵式肥脚本内容:--数字1if 1 then print("execute print when 1")end执行结果:execute print when 1
9、Lua中if条件为nil时,即为false,打印语句不会执行脚本内容:--nilif nil then print("execute print when nil")髫潋啜缅end执行结果:没有输出。