Howdy, Stranger!

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

Codea 3.0 (184)

dave1707dave1707 Mod
edited September 16 in Beta Posts: 7,878

@Simeon New editor: Dependencies don't stay selected when a project is closed and re-opened.

«13

Comments

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 just fixed it in the latest build. Thank you for the report

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon New editor: Dependencies now stay selected in build (174).

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon New editor: Is this supposed to happen. If I long press the space bar, the letters on the keyboard disappear and if I slide my finger I can move the cursor around the screen.

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon Old editor: The eye and magnifying glass keys on the keyboard don't work.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 yes, long pressing the space bar is a shortcut to cursor dragging (that's built into iOS now so I removed the dedicated buttons for it from the accessory strip)

    Damn! I broke the old buttons, thank you for finding that

  • Posts: 59

    @Simeon I exported my project to Xcode using the newest beta (174). I saw that the frameworks folder is empty except for a libversion file. Thought, I should point that out, just in case it wasn’t intentional. Sorry for constantly commenting about Xcode.

  • edited August 13 Posts: 1,369

    @Simeon - just loaded 174 and loaded new editor, loaded my recent project and ran - bombed out of Codea. Re-loaded Codea and project then ran again - ran OK this time ????

    Tried another project, an asteroid demo that I ha uploaded from an old post, and Codea bombed again. Will post a link once I find the Asteroid demo source again.

    Edit: demo was by @drablos code at https://pastebin.com/uTcXchab not sure why it crashes - don't have the tools to detect.

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon New editor: While in the editor, if you double tap a word, a pop up shows with options to select something. If you select Reference, nothing happens. I'm starting to get used to the new editor, but I find myself still touching the screen in spots for the old editor commands.

  • dave1707dave1707 Mod
    edited August 13 Posts: 7,878

    @Simeon New editor: Even though a project has an error (qwerty), it still runs, kind of, without a warning. Run the code below.

    PS. If the error is farther down or in another tab, you might not realize there's an error and wonder why you code isn't working.

    function setup()
        print("Hello World!")
    end
    
    function draw()
        background(40, 40, 50)
        strokeWidth(5)
    
        qwerty    
    
    end
    
  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 highlighting tabs which have errors (and scrolling to the errors) is the last feature I need to get in to reach parity with the old editor. I'll look at the reference issue too

    @Bri_G thank you for the report, will test

    @exomut no that's fine. Thank you for the report. The library folder will be empty until you first build, which triggers a build script to download the required libraries

  • edited August 14 Posts: 1,369

    @Simeon, @dave1707 - hmmm, interesting. New editor, placed qwerty in a long routine, way down so not visible when cursor at top of tab, in a multi tab project. The editor fired up the error - no problem. Ran as you say sorta.

    But, you can not see the tab error in the list of tabs - so when you load the project, including the error, then you don’t get the tab error feedback. Worse when you run the project it runs and fires out some spurious errors. When checking the tab where your error is - it is no longer displayed with the slide out error banner to the right. Suggests the code is not checked for errors when the project loads.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @Bri_G yes I'm working on error handling tonight, I'm going to have it highlight the tabs with errors even before you hit the play button. And scroll to errors when you visit those tabs.

    I've fixed the issue with the legacy code editor keyboard not working. Once the new code editor is up to parity I'm going to switch it over as the default and leave the legacy one as an option for a little while.

  • Posts: 1,369

    @Simeon - thanks for the update, ran into another problem - the search button on the old keyboard stopped working - get no response to tapping it.

    Also, I raised a question a while ago, can’t remember the feedback. On occasions I have run a project and it fired up errors - but it still responded to touches on the screen - printing out touch responses, which suggests that the project is still running in the background. Is that the case? When you stop the project and drop back to the editor is the closed down runtime actually closed and the memory clear?

  • Posts: 1,369

    @Simeon - can’t find any details on print() in the reference section looking to find how to print with consecutive lines and without spacing lines.

    Other thing, not obvious when you want to search reference section, from new editor. Needs the reference window pulling down - any chance of a prompt near the top?

  • dave1707dave1707 Mod
    edited August 15 Posts: 7,878

    @Bri_G If I want to print a bunch of text without the blank lines in between them, I put the text in a table then do a print(table.concat(tableName,"\n")) at the end of whatever.
    It still would be nice if the print statement didn't add the extra blank line.

  • Posts: 1,369

    @dave1707 - thanks for the info, picked up on that from a search. I always struggle with tables, I start off thinking I know them and always end up in a mess. But - it prompted me to search through some old code and I found out how to do it - manually concatenating a string with a “\n” after each entry using the string joining .. then just print the string. Worked for me on a 3D model reader. Thanks for the prompt.

    Though thinking about it “\n” is a new line I think “\r” is carriage return and may get round the problem. Another tangential trial to divert me from my current project.

  • Posts: 1,369

    @dave1707 - it looks like the print() statement includes a new line in the routine. So think I know how to manage this now.

  • Posts: 1,369

    All - does anyone know if you set up an table of vectors, in which the x and y values are calculated by formula, does the table instance store the formula or the value calculated when initially defined?

  • dave1707dave1707 Mod
    Posts: 7,878

    @Bri_G Not sure if I understand your question. You put vec2(x,y) in a table. Both x and y are calculated values. See this example for half a circle. I also print the values.

    function setup()
        tab={}
        for x=-200,200 do
            y=math.sqrt(200^2-x^2)
            table.insert(tab,vec2(x,y))
            print(tab[x+201])
        end
    end
    
    function draw()
        background(40, 40, 50)
        fill(255)
        for a,b in pairs(tab) do
            ellipse(b.x+WIDTH/2,b.y+HEIGHT/2,2)
        end
    end
    
  • edited August 16 Posts: 1,369
    @dave1707 - thanks for the feedback, not described my query very well.

    In setup() say define

    target = vec2(left+22,up+59)

    The use target in draw(), are values calculated in setup and stored in target or is it the formula and the calcs are done for each draw() iteration.

    Maybe setup() is a bad suggestion - what about global definitions in any other function?

    Edit: I am getting flickering in print() actions when I use output.clear() and am trying to make sense of it.
  • dave1707dave1707 Mod
    Posts: 7,878

    @Bri_G The calculation is done in draw. You would have to vary the values of left and up in draw or a function called from draw. Then target would be calculated and you would use target.x and target.y to do whatever. As for the flicker with print, I think that's caused because of the time it takes to clear the print area and the execution of the draw function. They're probably not synced.

  • dave1707dave1707 Mod
    edited August 16 Posts: 7,878

    @Bri_G Are you thinking of something like def in basic where you can do something like def sum(x)=x+2x+3x+4*x and then s=sum(8) would give s a value of 80.

  • edited August 17 Posts: 1,369
    @dave1707 - not sure, not seen that before, but it does look to operate in a similar way to what I have described. What I'm trying to do is cut down time in the draw loop by reducing calculations. I'll try my code by calculating the values before adding them to the table. Also I'll add FPS to check on the load on the draw() function. I've hit another issue with the touch function that may be causing the problem.
  • dave1707dave1707 Mod
    Posts: 7,878

    @Bri_G If the values of your calculations are repetitive with time, then you can calculate them in setup and build a table. Then in draw you can read the values from the table. If they’re not repetitive, then there’s no point in putting them in a table and you just have to calculate them in draw. Try to make as many of your variables local, that will speed things up.

  • Posts: 452

    @Bri_G When you do pos = vec2(left+3,up+5) then lua uses the current values of left and up and stores the result of the calculation.

    Although this is the opposite of what you're trying to do, then for completeness to make a vector vary you would need to make it a function (which could itself be a method on an object). So you would have pos = function() return vec2(left+3,up+5) end, or you could make left and up parameters of the function.

    This "calculate immediately" feature is quite useful when, say, swapping two variables: you can put x,y = y,x.

  • Posts: 1,369

    @LoopSpace - thanks for the feedback. What you describe is exactly what I suspected. What I was concerned about was that Lua places the formula, with current values of variables, into a table when set up in setup() (pardon the pun) and then recalculated whenever the variable is called from draw() or other functions.

    I think you’ve answered my question in that the formula is held in the table and could be used as a variable in subsequent calculations. I need to carry out the formula initially and store just the values in the table. I mistakenly thought that within setup the calculations would be done and just the values stored.

    Back to work . Thanks for the update.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    In 176 the new editor should now be at feature parity with the old one. Please let me know if there are any issues. The plan is to release Codea with iPhone support (finally) starting with this version if there are no major issues.

  • Posts: 411

    @Simeon loaded version 176 via testflight-but crashes immediately on startup (ipad pro).

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @piinthesky thanks for the quick report. Wonder if it's an issue with building under the iOS 13 SDK and running on 12. Looking into it.

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon Version 176. Same issue with me on an iPad Air. Loaded it twice and crashed both times.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    I'm just sending out a fixed build. Sorry for the trouble!

  • SimeonSimeon Admin Mod
    Posts: 5,054

    This is fixed in 177. Sorry about the bug

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon Version 177 now loads and runs OK.

  • dave1707dave1707 Mod
    edited August 18 Posts: 7,878

    @Simeon New editor. One thing that I miss is the arrow key that allowed me to move the cursor to the right. In the example below, after I would put the 2 in the [], I would use the arrow key to move the cursor past the ] where I would do = . I guess I have to get used to long pressing the space bar and then moving the cursor over.

    function setup()
        tab={}
        tab[1]=123
        tab[2]
    end
    
  • edited August 18 Posts: 411

    @simeon, 177 doesn't crash, but my current project no longer runs...seems readLocalData no longer picks up the default value (second parameter) if the variable does not yet exist?

  • dave1707dave1707 Mod
    edited August 18 Posts: 7,878

    @Simeon New editor: readprojecttab isn't working correctly. If you don't specify a project it should read the tab in the current project. It currently gives an error.

    If there is something in the very first line, auto complete doesn't work. That might have been mentioned in a previous release.

    Double tapping a word and selecting reference from the popup doesn't work.

  • Posts: 452

    @Bri_G I'm a little confused. You write:

    I mistakenly thought that within setup the calculations would be done and just the values stored.

    but this is what I said does happen. Consider:

    a = 3
    b = a + 4
    a = 5
    

    At the end of this, a stores 5 and b stores 7. b does not "remember" that a was used in its definition and changing a has absolutely no effect on b at all.

    The fact that you're using vectors makes no difference to this.

  • dave1707dave1707 Mod
    Posts: 7,878

    @Bri_G Actually you can put the calculation in a table. It would probably be a whole lot slower using it. See the example.

    function setup()
        left=5
        up=10
    
        tab={}
        tab[1]="target = vec2(left+22,up+59)"
    
        loadstring(tab[1])()
    
        print(target)
    end
    
  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 @piinthesky thanks for those reports, was your use of readProjectTab and readLocalData happening in the global scope? I.e., before setup() was run? I think I know what's causing it and can fix

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon My readProjectTab was in setup() and just a few lines of code to prove what was happening.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 oh okay thanks, must be something else then. I'll have it sorted before release

  • Posts: 411

    @Simeon my readLocalData was in setup()

  • SimeonSimeon Admin Mod
    Posts: 5,054

    New build should have fixes for the readData/Tab functions and reference menu.

  • Posts: 411

    @simeon, good, readLocalData now working again!

  • Posts: 411

    @Simeon, i notice if the dependence name is long, the size of the corresponding checkbox can become very small.

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon readProjectTab works now. readProjectTab doesn't find a new tab until Codea is closed and reopened. You said that was due to the way the File system works or something like that. That could be a problem in programs that create tabs and then try to read it again later in the code.

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon Double tapping a word and then tapping reference doesn't always show the info of what was highlighted. It would open the reference list but that's it. The first thing I tried for reference info was readProjectTab. The reference list was opened but that's as far as it went. I tried several other words, but there wasn't a pattern as to what worked and what didn't. What would be nice is if it worked like doing a search from within the reference list. For instance, if I search on camera from within the reference list, it shows a list for all of the camera usage.

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon Can you put the two arrow keys back in the top line of the keyboard. I'm finding more and more situations where I use them and using the long press on the space bar to move the cursor isn't working as well as those keys. Or is there a reason you removed them and can't put them back.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 I removed them because the two finger drag anywhere on the keyboard just seemed nicer (it's what I use when I want to move the cursor). But I'll look at putting them back.

    Thanks for the note on the reference, will fix.

    On the readProjectTab issue, are you saying that if you create a new tab (like Do -> New Class) then try to use readProjectTab to read it's contents it won't load?

  • dave1707dave1707 Mod
    Posts: 7,878

    @Simeon Try this code. It will create the tab test4 with save, but won't find it with read. If you close the project and run it, same error. If you close Codea then open the project and run it the code, it reads it.

    I ran into something else when I was creating this code. I saved a tab, but later I deleted it. I closed Codea and from another program that reads each project and each tab, it found the name of the deleted tab, but gave an error because the tab data wasn't there. So when I deleted the tab, the data was deleted, but the tab name was still associated with the project until I closed Codea.

    function setup()
        saveProjectTab("test4","--qwertyuiop")
        a=readProjectTab("test4")
        print(a)    
    end
    
Sign In or Register to comment.