코드를 실행하면 다음과 같은 오류가 있음을 알 수 있습니다 ')' expected near '='
.
function restartLvl()
for i = 1, #balloonTexts do
display.remove(balloonTexts[i])
print ("restart level")
end
score.text = '0'
ballRemain.text = '3'
balloonText = {}
createBalloons(1, 3)
if (askUser.isVisible = true) then --this is the line where the error occured
askUser.isVisible = false
end
if (yesBtn.isVisible = true) then
yesBtn.isVisible = false
end
if (noBtn.isVisible = true) then
noBtn.isVisible = false
end
end
나는 )
모든 괄호를 닫았 기 때문에 여전히 ' ' 가 누락되었는지 모르겠습니다 .
=
은 할당 연산자이고 ==
같음을 테스트하는 연산자입니다. 다음으로 변경하십시오.
if (askUser.isVisible == true) then
askUser.isVisible = false
end
그리고 다른 모든 것들도 마찬가지입니다. ()
단순화를 위해 대괄호 를 생략 할 수 있습니다.
if askUser.isVisible == true then
askUser.isVisible = false
end
값이 부울 이면 true 가 아니 nil
거나 false
true로 취급되는 모든 값이 있기 때문에이를 수행 할 수도 있습니다 .
if askUser.isVisible then
askUser.isVisible = false
end
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다