Codea 3.4.3 (301)

@Simeon I was able to paste (Add To) a sprite easily into a sub folder of a project folder. Also, are you still working on the 7 second delay for Codea startup or is that an iOS 15 fix.

@dave1707 the problem with the delay is a bigger fix than I anticipated. The faster-loading versions you had access to earlier had issues with crashing for you. So while I know where the code causing the delay for you lives, I can’t modify it easily

Do you use many sub-folders in your Documents folder for Codea? Or is almost every project just in your iPad Codea Documents folder?

It may speed things up to use sub-folders and organise your projects (though apologies if it doesn’t). As the delay appears to be related to listing directory contents for the documents folder on load

@Simeon All of my projects are in the documents folder, no sub folders. I guess I could try sub folders and see if that will speed things up. Just one problem, maybe two. I have two projects that parse through every project. One is a search that I use to list off any project that uses something specific I’m looking for. The other is a backup program that I use. Will the listProjects function also go into sub folders. That will decide if I do sub folders or not. The search program is used extensively when someone has a forum question about something.

@dave1707 good question. listProjects can accept an argument which is the “collection” you want to list. For example to list the example projects you can do:


However the better way to introspect your projects would be to use the asset key API

Here’s code to recursively search the Documents folder for all Codea projects:

function setup()

function projectsInFolder(folder)
    for k,v in pairs(folder.all) do
        if v.type == "folder" then
            -- Recursively search folder
        elseif v.type == "project" then

@dave1707 further to this, the asset API should completely negate the need for most of the project info and reading APIs

When you find a project, you can do

project.all to get a table of its files. If they are Lua files, you can simply read them with readText. This means specialised functions like readProjectTab are no longer needed

@Simeon That works. Thanks for the example, it saved me from trying to figure it out myself.

@Simeon Is there any way to add the expand and compress icon to the documents list of projects like there is for Examples and Craft. Just wondering if the list of projects for documents was compressed at startup if that would load faster. Then after Codea is loaded, we could expand the list of any folder.

Not trying to get out of creating a bunch of folders, just thought of that as I was creating some folders.

@Simeon Maybe I’m thinking about this all wrong. Maybe all my projects could be moved into a single folder then they would have the expand/compress icon. Just trying to figure out what I want to do before I start messing with 700+ projects.

Fair enough @dave1707, let me know what you come up with and if it works or not

@Simeon - apart from it being the latest beta I’m watching this thread closely as I use @dave1707’s archiving project and have simiilar code for other projects.

I was wondering if you can set flags on projects to indicate change - addition/removal/update of assets within, which may enable you to keep a hidden directory, to use on startup, then you could only update those that need it so you can speed up the start of Codea?

@Bri_G I try to avoid too many optimisations as they often have unwanted side-effects in other parts of the app. The code which is slow in this instance is simply listing the contents of the Documents folder — something which does need to happen on startup.

The way to make this faster would be to do it in the background while the UI starts up and then fade in the projects when complete. But I’ll see how dave goes with reorganising his projects before optimising for this scenario.

@Simeon - thanks for the update. Further question - we only load up one project at a time so - could you just load up the project icons initially (and folder images) then concentrate resources on loading the project or opening the folder when requested. Might slightly slow down response for each request but that may be less noticeable?

Or, is that the way Codea currently operates?

@dave1707 @Simeon - just loaded and playing with 301. One thing I noted was the Codea icon in the Fileapp is just showing a blank folder without the icon. Does that mean iOS is treating it as a basic folder not an app?

Secondly, after playing with 301 for a while I found Fileapp had locked up. Tried to duplicate but no joy so far.

Suggestion, whilst resolving all the other issues, could you organise the folders that are recent to the top (or can I get that from the setup menu already). I added a new folder and copied a file to it and it ended up at the bottom of the pile, open and showing the file).

p.s. checked the order and it was set to recent. Changed to alphabetic and the collection list was still in the same order.

Do you intend to display collections as folders in future. If so could you consider using a miniature project icon (like the apps folders in iOS).

Sorry for being a pain - these are probably features you’ve already added to 4 and seems a little pointless building up 3 if 4 is close.

@Bri_G good point about the sorting of collections themselves. They sort by name, but it makes sense that you might want them sorted by recent. I have thought about using folder icons for them, but it’s probably not something for Codea 3.x

@Simeon I moved all of my projects into a folder. If I have that folder collapsed, Codea starts up in less than a second. If I have the folder expanded, Codea takes about 7 seconds like it did before.

When I do a Create New project, it’s created in the documents folder. Is there a way in Codea to move the new project into the folder where I have all my other projects. Or could an option be added to Create New to choose a folder to create the new project into. I know I can use the Files app to move projects, just wondering about doing it in Codea.

Another thing, when Codea is closed, could all the folders be collapsed. Maybe that could be an option so those that don’t have a lot of projects and wont see the delay.

@Simeon - to make icons simpler for you - you could put a standard icon in the folder and permit users to change it thus avoiding Codea needing to create one.

I know it will add to the processing time but only you can determine how much.

@Simeon After moving all my projects into a folder, I’m noticing that functions like hasProject, createProject, deleteProject, etc aren’t working. At least I can’t get them to work.

PS. I moved all my projects out of the subfolder back to where they were. I’ll wait the 7 seconds for now. I would forget to compress the list when closing Codea and have to wait the 7 seconds to load anyways.

@Simeon the soundsplus example gives error message-due to the use of ‘loadstring’.

Also had a crash when restoring examples (sent you the crashlog). Worked ok the second time.

@Simeon Cargo Bot also has a loadstring in it. Just need to change loadstring to load until the Examples are fixed.

@dave1707 hasProject can be replicated using the asset key API. I will come up with more general replacements for createProject and deleteProject. Thanks for the details about how it takes longer when the section is expanded

@piinthesky thanks for the crash report! Will search and fix the uses of loadstring