这对于接触过其他语言的人应该都更熟悉,该语法使用框架:
if --[[内容]] then --符合后的事件 else --否则事件 end
若进行多次判断,可使用elseif。
使用示例:
a=1 if a==1 then print("a是1!") elseif a==2 then print("a是2!") else print("a不是1也不是2!") end