0

As a new lua programmer i am enjoying learning new things in lua. I am learning from: https://www.tutorialspoint.com/lua/lua_loops.htm However, when i practice my code it wont work. In my code i defined a object called "FolderImBalanced" and make that object to TRUE. Later on in the code i changed the object to FALSE. But the code is not working. How come? PLEASE NOTE: i have some "code" things in messages, so the code in the message is not REAL code. Its just a message, i was practicing using messages at the moment.

 --[[Inset Nil.Lua("ServerStorage")]]--
GetServerStats,UserImbalance = "Lua Server Status","Inbalance Pulsle"
print(UserImbalance)
--[[Do:Value=="Nil" Function Ontouched.]]--
FolderImBalanced,NewNilValue = true,false
while (true)
do
FolderImBalanced = false
end
print(FolderImBalanced)
0

1 Answer 1

2

The code you written is working, even though it may not do what you expect it to do. Right now, your while loop is executed indefinitely, as you set the loop condition to true (so it will always execute the loop body) and don't have any exits from the loop using break statements. Since the loop continues to execute indefinitely, the script will have to be aborted, as it will never exit the loop.

Sign up to request clarification or add additional context in comments.

1 Comment

If its a while loop it should repeat the code over and over again. So should'nt FolderImBalanced be placed true, if the code is repeating over and over again?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.