Over the last couple of months I’ve really come to wish that Codea had an option to disable execution of a tab when Codea runs my program. Since we now have the ability to load and execute files via loadfile and loadstring+ the io library, it becomes a lot more reasonable that we might want to have more control over when specific parts of our code are executed. There are 2 main reasons that I’d like to have this feature, one of them specific to my needs, but the other is the more salient one, so I’ll start with that.
Once a project starts to become larger in scale, usually you end up with a lot of files that are just data. For example, if I make a game with 50 levels, I’ll probably have 50 files with level data in each. If I have all of these files as tabs, currently, Codea will load and execute all of these files, and retain them in memory, even if they are only used infrequently. It would be a huge optimization for larger games to be able to selectively load our tabs containing data so that e.g. in cases like lots of levels, we could use loadfile/loadstring+io to load our data tabs and ensure that only 1 level would need to be in memory at a time.
Secondly, I’ve been working on a module/package system over the last few weeks, and I’m pretty much done with it. However, it has an ugly wart that the contents of any file that wants to be loaded by the package manager must be wrapped in a function, as a workaround to Codea automatically executing all of the tabs at run time. Additionally, this workaround most likely causes a lot of garbage collection churn at program run time from executing all of the tabs, and then (I assume) discarding the unused chunks.
I envision that the Main tab would not be able to be excluded, since it is the program entry point, however dependencies would honor the exclusion flag on their tabs when they are executed.
I can see 2 ways to handle the UI for this: 1) on the long press menu for tabs, add a checkbox option to enable/disable execution (all tabs are enabled by default). 2) present a list like the dependencies list, listing all of the tabs in the project with checkboxes next to them; there would also be a ‘select all’ and a ‘deselect all’ option.
Does this sound like a reasonable thing to include?