TabGrabInator: another tool to use after the bug fix

A tool for editing dependencies without having to change projects.

Use ‘get’ to import a single tab; then make your edits; then use ‘putBack’ to put it back.

The dependency will now use your new code.

You can also get and put back multiple tabs from different projects all at once.

Just use ‘getMultiple’ with a table that follows this structure:


     tableParameter = { 
                          [project1Name] = { tabName1, tabName2, ... etc },
                          [project2Name] = { tabName1, tabName2, ... etc },
                          ... etc
                    }

NOTE: be sure to be on the Main tab before running any of the putBack commands. Codea doesn’t like it when you are currently on a tab when that tab is deleted.

But again, this relies on the readProjectTab and saveProjectTabfunctions, which seem to have been causing trouble.

Personally I plan to use this a lot, but buyer beware.

The demo project here should be self-explanatory but let me know if it’s confusing.

update: changed the name to TabGrabInator

crashes when i press gettab button. what am i missing?

DependencyAccessInator:19: Project tab "dependencyTestFunction" not found
stack traceback:
	[C]: in function 'readProjectTab'
	DependencyAccessInator:19: in field 'get'
	Main:23: in function 'getTab'

@RonJeffries Crashes? I haven’t seen that. You need to designate the other two files as dependencies, did you do that? Sorry if that wasn’t clear—I thought they would already be linked since they were when I zipped them.

@RonJeffries

Replace these functions:


function getTab()
    DependencyAccessInator.get("DependencyTest", "dependencyTestTab")
end

function putBackTab()
    DependencyAccessInator.putBack("DependencyTest", "dependencyTestTab")
end


@RonJeffries I’ve updated the zip now, with those changes.

after putting back multiple tabs, if i then exit the program, codea crashes to the desktop. i don’t see why the thing wouldn’t work, but it’s deadly.

@RonJeffries that’s not a result I’m seeing, either on iPhone 8 or on a 12 inch iPad Pro.

Does it happen just after tapping “put back” once?

But yeah Codea seems to bug out around this tab-reading-and-saving stuff, hence the title of this thread.

@RonJeffries scratch that, I am seeing it on iPhone, just not iPad.

For me, I have to actually change the tabs before putting them back to make it crash; if I don’t make changes the tabs are fetched and put back no problem—same for you?

If it happens on iPhone but not iPad, does that give you any sense of what it could be?

@RonJeffries I think I have it.

The problem happens when you start running the program while you’re on a tab that gets deleted when you tap “put back”.

It seems like Codea freaks out when you try to exit the program to a tab that’s not there anymore.

Please try making changes to the tabs and then being sure to be on the Main tab before you run the program and tap the “put back” button.

Please let me know if that prevents the crash for you, as it does for me…

probably it. will let you know if i try it again.

@RonJeffries I’m trying to think of a way to enforce people being on the Main tab before putting back tabs. Can you think of anything?

no

@RonJeffries I’ve added a primitive thing I called the EnforceInator that requires explicit confirmatory action before letting any of the putBack functions proceed.

It doesn’t prevent someone from doing the things that cause the crash, but at least it informs them how to avoid it.

It’s not great, but it’s something, which seems like my programming mantra of late.