Codea 3.2.1 (220) does not understand listGlobalData

-- 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

@RonJeffries Should be

for k,v in pairs(t) do

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

ah. sorry. i do that every time :slight_smile:

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

why does listGlobalData not highlight?

@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.

@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

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

@Simeon - I see the bug occasionally but not sure how to reproduce it. Will pursue next time it occurs.

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

@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.

@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.

@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?

@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?

@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)

@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?

@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

@Simeon - thanks for the update. I can see your logic there.