Howdy, Stranger!

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

Will the new update break compatibility? (Asset keys)

in Questions Posts: 96

Hallo everyone,
I just wanted to ask whether the new update could break compatibility with code from the previous versions.
I'm interested in the new asset features but I use "assetList", saveText/loadText and a lot of "Documents:...". Will those functions still work or will my project fail to run? I don't want to risk breaking my projects since downgrading to a previous version isn't possible anymore after updating.

Secondly, I read something in the description of the latest update about subfolders in projects and being notified about changes in "MyFolder". Does that mean that Codea projects (exported) can have integration with the Files app or is this restricted to the development process? Could this be opened up to exported projects and is it possible for exported Codea projects to import new files such as images into its folder?

Thanks in advance :)

Comments

  • Posts: 496

    assetList is deprecated but works. and it's not usually hard to replace it with current stuff.

  • Posts: 96

    Thanks!
    Do the other commands (saveText specifically) work as well?

    I will replace them eventually, but in larger projects, that's a lot of work :/

  • SimeonSimeon Admin Mod
    Posts: 5,202

    @Leon saveText will continue to work with the string version but nearly anywhere you can use the "Documents:MyFile" syntax you can replace it with an asset key (asset.documents.MyFile). Using the string variant of some functions will print a warning that you should asset keys, but that's the main change.

    Please post here if you run into trouble

  • Posts: 96

    @Simeon Thanks, that's great to hear!

    Does it also print a warning in an exported App? I use the parameter window, so any print on the console would be visible.

    I hope it's okay, if I repeat my second question :) :
    I read something in the description of the latest update about subfolders in projects and being notified about changes in "MyFolder". Does that mean that Codea projects (exported) can have integration with the Files app or is this restricted to the development process? Could this be opened up to exported projects and is it possible for exported Codea projects to import new files such as images into its folder?

  • SimeonSimeon Admin Mod
    edited March 26 Posts: 5,202

    Yes it will print warnings in an exported app

    On the second, yes you can integrate with the files app by monitoring a folder. For example, to monitor the documents folder for your app:

    asset.documents.updated = function(lib) 
        -- lib is the asset key for the documents folder
        print("Num files:", #lib)
    
        for _,file in pairs(lib.all) do
            -- scan through all the files to see what changed...
            print(file.name)
        end
    end
    
  • Posts: 96

    @Simeon Thank you!

    That's fantastic, great to hear that :)

Sign In or Register to comment.