Codea 3.3.3 (280)

@UberGoober If a position is changed, then you’re doing a save constantly as it’s being moved. From my example above, it looks like it takes .6 seconds per save and it gets buffered up and the updates continue until all the updates are done. I’ll have to add more code and see how it affects what else is running.

or a position is otherwise changed

@dave1707 maybe I was unclear: it saves on touch.state ENDED

@UberGoober OK, now it’s clear, just on ENDED.

@Steppers yeah for a self-modifying project you will see issues if you use non-coordinated read/writes. For modifying other projects you probably won’t see issues, but if those projects are currently open in the Files app, or, say if Codea one day supports loading multiple projects at once, you might see issues.

i’ll be interested to see what this does to codeaunit, but i expect it has few users …

@Simeon Ok, I guess I’ll just deal with any issues if and when they arise then.

@Simeon Ran into a problem with version 280. The code would not execute, it just stayed in the editor. I pressed the run icon at the top right, nothing. I pressed the run icon on the top right of the keyboard, it turned white but did nothing. I long pressed on the upper right run icon and it displayed the “Save and Run” selection. I pressed that and nothing. The editor worked as normal, I could delete and add code. I exited the editor and went back in. Tried to run the code, but nothing. I exited Codea and went back in and everything was OK.

@Simeon So far I’ve had the problem of the code not executing 3 times. I can’t make it happen, but the conditions that was causing it was going into a possible infinite loop and having to force stop the code, but not exiting the editor.

@dave1707 - could you post some of your code. I’d like to know what area we need to focus on to see if we can narrow this down.

Just in general, recently I’ve found response to touch on my iPad getting poor. Sometimes needing a long touch to run from the editor. I was suspecting degradation of the screen protector or the screen itself - my pad does get some hammer.

Have modifications in iPadOS wrt touch changed - is it a result of upgrading iPadOS to meet the demands of metal?

@Bri_G @Simeon I don’t have the exact code that was causing the problem anymore. But what I was doing was reading a large string and displaying small chunks of it to the screen, line after line. What I suspect was happening was that I was going into a tight loop reading the string but not displaying anything. Or possibly reading past the end of the string and not realizing I was supposed to stop. I would be able to stop the program without having to force close it, make changes, but then it wouldn’t execute until I exited Codea. I’ll try writing something again and see if I can force the problem.

@Simeon @dave1707 @Bri_G I had this happen to me too, yesterday. I don’t know if it had anything to do with it, but my project was also experimenting with heavy loop usage. I was trying to see if I could use coroutines to create a loop that I could break out of with a button press. Never got it to work, by the way, but I did see this bug.

@Simeon find and replace bug:

I downloaded this project and did a find/replace to turn “unpack” into “table.unpack”. After doing this:

  • If I exit out of the project, and re-open it, the changes are gone
  • If I run the project, it runs as if the changes have been made, but if I then exit the project and re-open it, the changes are gone

I’m still getting the project-reversion bug, now it seems like it happens every time I run a project that writes to tabs. It’s getting maddening. @Simeon if automatic save on run would fix this I am emphatically in favor of it.

@Simeon @dave1707 @Bri_G I’m getting this bug consistently now. I’ve been using my breakpoint code in conjunction with debug.sethook() to create a primitive step-by-step debugging system and every time I use it, when I exit to the editor the play buttons no longer work.

@UberGoober Can you cut your code down as small as you can and still get the problem. Then post the code. That will help @Simeon fix the problem. That way he’s not spending time trying to write the code to cause the problem.

@dave1707 good point. I had thought maybe it would be obvious to @Simeon what was going on without any more information, but when you point it out, that seems like rather muddled thinking on my part.

This reproduces it:


-- PlayBug

parameter.boolean("breakpointsEnabled", false)

breakpoint = function()
    if not breakpointsEnabled then return end
    print("tap tab to advance a line, type 'qq' to exit breakpoints")
    local buffer = ""
    showKeyboard()
    while buffer ~= "\\t" do
        buffer = keyboardBuffer()
        bufferLength = string.len(buffer)
        buffer = string.sub(buffer, string.len(buffer)-1)
        if buffer == "qq" then
            buffer = "\\t"
            breakpointsEnabled = false
        end
    end
    hideKeyboard()
end

function trace(event, line)
    if not breakpointsEnabled then return end
    local s = debug.getinfo(2).short_src
    print(s .. ":" .. line)
    breakpoint()
end

function setup()
    needToStartDebug = true
end

function draw()
    if needToStartDebug then
        debug.sethook(trace, "l")
        needToStartDebug = false
    end
    for i=1, 2 do
        i = 0
    end
end

Run it, toggle breakpoints on, tap ‘tab’ a few times to advance a few lines, and exit to editor. Play button no longer works. At least, for me.

@UberGoober thank you for that code, I can reproduce using the following steps:

  1. Run code
  2. Turn on breakpoints
  3. Tab through a few breakpoints
  4. Exit to the editor by swiping from the left to close the viewer
  5. Try to play

If I exit by typing “qq” then the project runs fine on subsequent attempts. This leads me to thing it’s something to do with the sethook call

@Simeon I mentioned the project not running problem farther above and I wasn’t using a set hook call. I was doing a lot of looping in the code and would stop the code to make changes. After making changes, the run icons wouldn’t work.

@Simeon also as you may have noticed the breakpoint() function is mainly just one neverending loop, and that’s what sethook is fundamentally calling.

I also have seen this in projects where I didn’t use my breakpoints and it also seemed connected to loops.

@Simeon This code also causes the no run problem. Run the code and slide right from the left edge to end the program then try running it again.

function draw()
    while true do       
    end
end