Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Can Dependencies import Main tab

I'd like to import the main functions setup and draw and a couple of other functions when I set CodeaUnit as a dependency. It appears that I can't import the Main tab from a dependency.

Is that the case?

Is there anything special about Main? Could I just add a tab Main-C or something like that?

Thanks!

Comments

  • edited August 28 Posts: 1,807
    @RonJeffries - not tried this but would expect the main, draw and touch functions to be locked to the masters in the default program. Do any other 'duplicated' functions present in both the master and dependency show the same behaviour.

    I have got round situations like this by providing different conditional routines in main and draw.

    Another way is provide different initialisation conditions called by functions in setup and different draw routine function calls dependent upon a conditional variable. So
    ~~~
    function setup()
    option = 1
    init()
    end

    function draw()
    if option == 1 then
    drawit()
    elseif option == 2 then
    drawthat()
    end
    end

    function init()
    if option == 1 then
    setup1()
    elseif option == 2 then
    setup2()
    end
    end
    ~~~

    In other words minimise entries in main setup() and draw().

    One of the features I miss in Codea is the ability to run one project from another. This used to be supplied in BBC basic by the 'chain' call which would free up memory, pass variables to another project and run it. Great way of running large programs in small memories.

    Edit: posted on an android phone so formatting will be adjusted later.
    Edit2: don't know just what it's done but can not edit out the comment ~~~ characters properly in this on my iPad or my Mac ????
  • dave1707dave1707 Mod
    Posts: 8,561

    @Bri_G Apparently you forgot about this. Run different projects from a menu. In the “proj” table, enter the names of projects you want to run.

    https://codea.io/talk/discussion/9366/run-projects-from-a-menu
    
  • Posts: 1,807
    @dave1707 - woah - dementia setting in. No recollection of that. Have to dig further into that now. Cheers.
Sign In or Register to comment.