Howdy, Stranger!

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

Codea 3.2.1 (220) does not understand listGlobalData

in Bugs Posts: 616

-- Use this function to perform your initial setup
function setup()
    saveGlobalData("kkk", "vvv")
    local s = readGlobalData("kkk")
    print(s)
    local t = listGlobalData()
    for k,v in t do
        print(k,v)
    end
end

main:9: attempt to call a table value

Comments

  • dave1707dave1707 Mod
    Posts: 8,398

    @RonJeffries Should be

    for k,v in pairs(t) do
       print(k,v)
    end
    
  • SimeonSimeon Admin Mod
    Posts: 5,364

    This always catches me as well, I wish Lua would just treat tables as iterators!

  • Posts: 616

    ah. sorry. i do that every time :)

  • Posts: 1,726

    @Simeon - still getting these errors from searching (see image).

  • Posts: 616

    why does listGlobalData not highlight?

  • dave1707dave1707 Mod
    Posts: 8,398

    @RonJeffries I think I mentioned that long ago, or something similar. I think the answer I got was not everything is highlighted. I’ll search to see if I can find what I’m talking about.

  • SimeonSimeon Admin Mod
    Posts: 5,364

    @Bri_G I recall you reporting that, do you know how you reproduce that?

    @RonJeffries that's a bug, I've changed it so it highlights

  • Posts: 616

    super. that was part of what threw me off the pairs track, that it didn't highlight made me think it wasn't known.

  • edited April 30 Posts: 1,726
    @Simeon - I see the bug occasionally but not sure how to reproduce it. Will pursue next time it occurs.
  • edited April 30 Posts: 1,726

    @Simeon - 223 here - very quick response on the scrolling - thank you, much better editing now.

  • edited April 30 Posts: 1,726

    @Simeon - quick look produced what I see. Loaded a project, searched for ‘sprite’ selected first one and found highlighted image of sprite in main code. Closed window and scrolled - image retained and scrolled with text. Video taken - will try to post.

  • dave1707dave1707 Mod
    edited April 30 Posts: 8,398

    @Bri_G @Simeon What I found when doing a search. If the word you search for is near the top of the code and you close the search window, the yellow highlighted area overlays the word you searched for. If the word is at the bottom of the code and you close the window, the yellow highlighted area is a couple of lines below the found word. The larger the code and the farther down the code the searched word is, the yellow highlighted area is farther below the searched word when you close the search window. To get rid of the yellow highlighted areas, you have to clear the searched word from the search pane before closing the search window.

    PS. If the word you search for is near the bottom of the code, the yellow highlighted area will be below the code when you close the window. If it’s too far down, the yellow highlighted area won’t show when the search window is closed.

  • edited April 30 Posts: 1,726
    @dave1707 - that was thorough. I tried with short code but didn't see the highlighted text. That's why I suggested trying it with a long code tab. Struggled to post video on youtube with my iPad, but don't need to now you've, very efficiently, confirmed the effect.

    @Simeon - have you got dependency changes in you plans?
  • Posts: 1,726

    @Simeon - just something that can be a little annoying. When you put a colour statement in an if then end structure sometimes the end is covered with the fill wheel icon. Sometimes you can just see the d.

    Like ..


    if lp == 17 then fill(255, 0, 8) end

    Not sure if you can change this much, I kinda like the colour wheel icon. Thought, could you put it at the end of the r,g,b,a list inside the bracket?

  • SimeonSimeon Admin Mod
    Posts: 5,364

    @dave1707 @Bri_G thank you for the info on the highlight bug

    I do have changes planned for dependencies. I'd like to move them into your code rather than in the project info

    Not sure what I can do on the colour wheel. If I move it inside the brackets then you can't tap it as you type (the cursor will be too close it so it will disappear)

  • Posts: 1,726
    @Simeon - are you planning to incorporate 'require' so that we can include libraries and tabs from other projects. If so would it also allow the inclusion of other external libraries?
  • SimeonSimeon Admin Mod
    Posts: 5,364

    @Bri_G require already works, in that you can do require('socket') and similar to import bundled libraries

    We can't really use require with Codea projects. It doesn't make sense as it has more jobs: it has to include assets, as well as multiple code files, and it imports into the global namespace

    I was thinking of a dependency function using the asset system to specify projects, like

    dependency( asset.builtin.Craft.Cameras )
    dependency( asset.documents.MyLibrary )
    

    The reason for building on-top of the asset system is that we might want to support cloud document providers, or USB disks, and other systems in the future. Asset resolution will eventually handle these cases and makes sense to use to reference other Codea projects

  • Posts: 1,726
    @Simeon - thanks for the update. I can see your logic there.
Sign In or Register to comment.