dependencies sticky?

i have a little test example that uses CodeaUnit as a dependency. however when i open the dependencies window and uncheck the dependency, the program still works. is that expected? what if i actually wanted to drop one?


weird. i’ll play further. it’s CodeaUnit that’s doing it.

ok, i checked that there were no dependencies. closed file, closed codea, rebooted ipad, started codea. main clears _ var. ran program. codeaunit button still there. pushed it and got failure in trying to use _. note the button was still shown w/o the dependency. something isn’t getting cleared.

@RonJeffries I get the feeling that dependencies are only updated under the hood when first added or when codea is launched. ICYMI here is another dependency related issue:

@Simeon - would your proposed changes to Dependencies resolve this?

I have found the dependency to be there even after I closed the file, opened another, closed it, closed Codea, and restarted.

@RonJeffries I don’t have any dependency code that I’ve written and use, but all of my Craft code uses Cameras as a dependency. If I uncheck Cameras and run the code, I get an error saying that I need Cameras. I don’t have to exit the code to get the dependency error message. So I’m not sure why you don’t get an error when you uncheck your dependency. Are you executing any of the code that’s dependent on it. I don’t think you get an error until you try to execute the dependency code.

@RonJeffries I created some code to be used as a dependency. If I uncheck the project as a dependency and run the code, I get an error. If I recheck the code it runs OK. I also altered the code so it didn’t try to execute the dependency code until I touched the screen. No errors until I touched the screen to execute the dependency code.

@RonJeffries you can check from your code what’s in the dependencies by doing this:

function setup()
    local xml = readText(asset.Info)

This is an XML file containing the project metadata. One of those entries will be for “Dependencies” containing an array of strings referring to other projects

It looks like there is a bug where adding/removing dependencies is not saving correctly unless you long-press the “Play” button in the upper right corner and choose “Save & Run”. I’ve noted this down to be fixed

Super, thanks!

I am having issues with dependencies …
When I trie to instantiate from a class which is my dependencies, I get an “attempt to call a nil value (global Score)” error.
Using Simeons method to check dependencies, I found that indeed, there is a dependency to the project containing the definition of Score.

Not sure what I am doing wrong … (hope this is enough information)

@JhaSeh If you do something like this in your code, it should print “table: hex address” of the class you included as a dependency which looks like it’s Score. If it prints a hex address, then the dependency class should be OK.

function setup()

Here’s an example using a class called score. This should print the same type of info if the Score class was a created as a separate project and used as a dependency.

function setup()


function Score:init()    

are dependencies loaded first? that message is one you can get when you subclass from something not yet defined.

Guys, thanks for replying so fast …
@Dave1707: yeah, I know, but it doesn’t.

The funny thing is that the project that gave me the error yesterday, is now running as expected. I’m 100% sure something fishy is going on in the dependencies area!
I would expect others to experience something like this as well, please let me know if you do (or else I will go crazy).

I will keep monitoring it, for now everything seems to be ok.
Sorry for the inconvenience.

@JhaSeh Without seeing any code it’s hard to say what’s happening. Is it possible you have another variable or something named Score that’s getting mixed up with the class Score. Or maybe you had the spelling wrong or a lower case s instead of S. Those are ways I can get your exact error message.

I use dependencies a lot and haven’t had any problems.

@dave1707 I think I didn’t mess up, since I put down my Ipad yesterday, frustrated over the issue, saw your answer this morning and wanted to add my code in a reply, but when I ran my sample project I was surprised the problem had vanished.

But hey, I am puzzled by it myself and have been using dependencies in my projects myself for years and years, without problems.

If I find something, I’ll make sure to let you all know :wink:

I wonder if you may also get the nil value error when there are circular references in the module dependencies, between two or more tabs.