加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如果,否则,否则如果和结束Lua

发布时间:2020-12-15 00:21:22 所属栏目:大数据 来源:网络整理
导读:任何想法为什么这是错误的Lua? if Pieza == 1 then if Rotacion == 1 then Piezas = Cuadrado1 else if Rotacion == 2 then Piezas = Cuadrado2 else if Rotacion == 3 then --this is Line 273 Piezas = Cuadrado3 else if Rotacion == 4 then Piezas = Cu
任何想法为什么这是错误的Lua?
if Pieza == 1 then
            if Rotacion == 1 then
                Piezas = Cuadrado1
            else if Rotacion == 2 then
                Piezas = Cuadrado2
            else if Rotacion == 3 then --this is Line 273
                Piezas = Cuadrado3
            else if Rotacion == 4 then
                Piezas = Cuadrado4
            else
                io.write("Me Envio una rotacion que no existe? n");
            end 
--this end closes the if inside the first if the one using to compare Rotacion
        else if Pieza == 2 then
            if Rotacion == 1 then
                Piezas = I1
            else if Rotacion == 2 then
                Piezas = I2
            else if Rotacion == 3 then
                Piezas = I3
            else if Rotacion == 4 then
                Piezas = I4
            else
                io.write("Me Envio una rotacion que no existe? n");
            end
--this end closes the if inside the first if the one using to compare Rotacion
        else  --this else is in case Pieza != 1 || 2
            io.write("Me Envio una pieza que no existe? n");
        end --this close the whole if (the one comparing "Pieza")

我得到的错误是这个’结束’预期(在第273行关闭’if’在’else’附近)

另外,在每个if之后添加结束(这不是应该做,但是尝试它)不工作…

如果你需要我翻译成英语,我会很乐意做评论和一切,但我认为这不是必要的这个问题。

解决方法

这是elseif,不,如果(通知空间)。错误是因为解释器期望结束每个其他块。

有关详细信息,请参阅the manual。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读