Feature Request: Optional disabling of tab execution on program startup

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?

1) on the long press menu for tabs, add a checkbox option to enable/disable execution (all tabs are enabled by default)

This sounds like the way to go. That’s quite a good idea, I’ve added it to my feature tracker.

Excellent, thank you! :slight_smile:

This is a great idea… Thanks for suggesting it.

would be nice if this was also available through the project tab api stuff.

.@gunnar_z I suppose that could be interesting, though I can’t think of a practical application for it. Got any ideas in mind?

@toadkick I use codea as a sort of idea scratchpad, so I write stuff that may generate all sorts of data, especially in textual form. I know that I can use io.write and co but then I need some additional tool to view the stuff, and with the project tab stuff I can just use codeas editor for this. Also for input data. For the generated stuff it would be nice to just mark the tab as non-executable, rather than enclose it all in a long comment (especially useful when i generate lua code, for the examination of which I could then take advantage of codeas syntax highlighting). Debug logs also come to mind.

Good answer :slight_smile:

gunnar thats brilliant I doubt many people will have thought of that! This would be a great feature

Hello, on my jailbroken iPad I use the “require” command to load my modules class.
I created a folder “usr/local/lib/lua / 5.1 /”

Actually, part of the reason that I requested this is because I’m writing my own module system, that a) doesn’t suck like Lua’s and b) is tailor made for Codea. Also, not everybody wants to jailbreak their iPad (namely, me :wink: )