for a in function()
return 2
end do
print(2)
end
Codea gets stuck after activation.
for a in function()
return 2
end do
print(2)
end
Codea gets stuck after activation.
One thing I noticed running @Anatoly code above, even if I did the Save and Run, the code wasn’t saved. It reverted back to the original code.
Today happened again.
Summary: First of all, the editor dies. The comments stop being green, an error is shown even if already fixed. Exiting the app let’s to code loss. I believe this is a bug with the error message (which checks the code while being coded for syntax). Probably at some point it stops checking and ignores code changes. (Since your code is stored in two different ways: A string variable of what you see right now and the storage where your code is saved. I believe specific errors lose the connection.
Sadly my internet lagged out and the post was trashed. Here were two points:
@Anatoly - yup, same on my machine but I can’t really understand what you are trying to achieve with that code?
Just about any infinite loop will crash Codea. The one below will crash too.
One thing I noticed when I was playing with this, any code changes weren’t saved. But that was expected because I know that if Codea crashes, it doesn’t save code changes.
@Simeon One thing I noticed running @Anatoly code above, even if I did the Save and Run, the code wasn’t saved. It reverted back to the original code.
PS. Even my code wasn’t saved when I did the Save and Run. I wonder if any kind of a problem in setup might be causing the loss of code.
function setup()
while true do
print("a")
end
end
@dave1707 nice to notice that if you remove the print function,you can still exit the code. It’s hard, but possible.
I believe it’s because printing is such a slow function. Not sure however why Save & Run won’t work.
@LoopSpace was trying to create my own interators, just was testing out some stuff.
It’s suggested for anyone who uses the while loop:
That’s an interesting infinite loop. The anonymous function is defining an iterator which can be repeatedly called. The classic iterator is ipairs
, but it’s possible to define your own. In this code, you’re defining an iterator which returns the value 2
whenever it is called.
The for ... in ...
syntax will keep calling the iterator until it gets a nil
. Since it always returns 2
, it will never end and the for
loop will keep going round.
As I said - an interesting infinite loop!