I want to publish a set of “step by step” tutorial projects for Codea, that lead a new user through building a project. Each step will be in its own separate tab and can run on its own.
I’m looking for the best way that users can run one selected tab on its own. Given that this is for relative newbies, it must avoid complications or confusion as far as possible.
Below are demos of two possible approaches which allow users to move from running one tab to running another, using parameters.
The first approach is to enclose each tab’s functions in a table so they don’t clash with each other, as demonstrated below. This is pretty clean, except the table prefixes may confuse newbies, and if they copy the code to their own projects, they will have to delete all the prefixes, so it’s not very portable.
Demo 1: https://gist.github.com/dermotbalson/6504325
The only way I can see of avoiding prefixing the functions in each tab with a table ID, is to have duplicate setup, draw etc functions in each tab. Codea will compile them all from left to right, and only run the last one compiled. So I need a way of moving the selected tab to the right. I could ask the user to drag the tab they want, to the right, but this is a bit messy and confusing for newbies, and the tab order could get jumbled.
So the approach below copies the code for them, to a special Code tab on the right. Having made a selection with a parameter, they simply need to restart to activate their new selection (using the icon at bottom of screen, so it can be done without going back to the code editor).
The advantage of this approach is very clean code which is completely portable, and I think I prefer it.
Demo 2: https://gist.github.com/dermotbalson/6504690
Comments, preferences and suggestions please, because I’d like to get it right before I plug a whole bunch of projects into it.