Howdy, Stranger!

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

Codea 3.0 (184)

2

Comments

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon I tried using your two finger drag on the keyboard and I find it really hard to use. Here's one example where I miss using the arrow key. Try keying what I have in the first tab in the second tab. Normally I would tap the "" key, key the letter a, then tap the right arrow to move the cursor past the ". I would tap the , key then the "" key and key the letter b. And so on. There are a lot of situations where I need to move the cursor one position to the right and tapping the arrow key is fast and easy.

    function setup()
    
        tab={"a","b","c","d","e","f","g"}
    
        tab={}
    
    end
    
  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 I do see your point on this and there is room for the key on the keyboard. I'll play with the software keyboard and try your examples then see what works, it's likely I'll re-include the key

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707

    In build 179 when you want to use readProjectTab on the current project in the new code editor you should long-press the play button in the top right and choose "Save and Run"

    Saving a tab and attempting to read it should work now, and you shouldn't need to reload Codea to read tabs correctly out of projects

    The new tabs you create may not appear immediately in the code editor if you exit the runtime straight away, but the hope is that they pop in shortly after they are created

    Some background on why this is necessary: the new code editor doesn't commit projects to disk when you run them. Writing all the code to disk from RAM can be expensive (especially if another app on your iPad is also editing the project) and not really necessary for most Codea projects — because most don't self-modify with saveProjectTab

    But readProjectTab et al. expect that the data on disk is always up-to-date, which may not be the case when you run a project now

    I've put in a hidden feature you can use to ensure that when you run your project it writes to disk first. Long press the play button in the top right for ~2 seconds and you will get a dialogue to "Save and Run"

    You need to do this is if you have added or deleted tabs, or modified your code and want to use readProjectTab to read these changes in the current project

    (Alternatively you can close and open your project again, but this is faster)

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon Version (179). Thanks for putting the arrow key back, that makes writing code a lot easier. Also, long pressing on the arrow key allows you to move the cursor around. That's always worked in previous versions.

    The Save and Run works great.

    I'm still trying to figure out the reference changes.

    One thing I've notice when I was testing the new changes, the indentation after pressing return stops working. If I key for z=1,10 do and press return, the cursor on the next line is left justified instead of being indented. When I key function somename() and press return, the cursor goes to the next line left justified and doesn't add the end keyword. It doesn't happen all the time and I'm not sure what causes it. I'll play around with that more.

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon Suggestion. I was testing the save and readProjectTab and I though the save wasn't working. I code in portrait orientation and the editor looks a little different than landscape. When I tapped the tab list, it wasn't showing all my new tabs in the drop down. That's when I realized you only show 9 tab names when in portrait orientation and you have to scroll the list up to see the rest. When you have more tabs then what you show, can you add a message to the list, something like scroll down for more tabs. I very seldom use tabs, so that's up to you.

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon Some weird things happening. I tried the below code again that was causing an error before where it wouldn't find the created tab unless I closed Codea. You added a Save and Run option to fix that. I tried running the below code just by tapping the run icon expecting to get an error, but I didn't, and it created the tab and read it correctly. I then changed both test4 to test24 and ran it again. No error. I exited back to the editor and after about 2 seconds the test24 in the code changed back to test4 without me doing anything. Does that mean new code changes don't get saved unless the Save and Run is done.

    function setup()
        saveProjectTab("test4","--qwertyuiop")
        a=readProjectTab("test4")
        print(a)    
    end
    
  • dave1707dave1707 Mod
    edited August 20 Posts: 7,912

    @Simeon After running the above code and closing the editor, I went back in to try something else. I added an empty function, ran the code, exited to the editor and after a second or 2 the new function disappeared. I went to try it again and when I keyed in the empty function, I was getting the left justification problem.

    PS. I closed Codea and got something to eat. Later I tried the above code again, but I wasn't getting the code to switch back. I was still getting the left justification problem though.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 thank you for all your feedback. I'll try reproduce the indentation issue

    Good point on the tab list — it's actually a bug that it's showing the list on iPad in portrait. It should be using that on iPhone and when iPad is in split-screen. I'll think about how to make the scrolled off region more obvious

    On your issue:

    I tried the below code again that was causing an error before where it wouldn't find the created tab unless I closed Codea. You added a Save and Run option to fix that.

    This is not quite what is happening with "Save and Run." Basically your initial code (save tab, read tab) should work without requiring Save and Run, because in this case saveProjectTab immediately creates the file on the file system, and readProjectTab can immediately read it without issue

    The time when you want to use Save and Run is if you want to readProjectTab for code you've just modified in the new editor. So if you have deleted, created or edited tabs and hit the run button, the readProjectTab command might read the old version (which is sitting on disk, or it exists but should be deleted, etc)

    So you are right in observing that new code changes won't propagate to the readProjectTab API unless Save and Run is used

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon Thanks for the clarification on the Save and Run. I guess I didn't understand it fully. One question with it. When you long press the run icon, you give two options, Run Only or Save and Run. Do you need the Run Only. Isn't that the same as just tapping the run icon. That would mean you only need the Save and Run option.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    Yeah good point, I'll change "Run only" to "Cancel" instead

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon Maybe I should have asked this sooner. Why not just do the Save all the time before running the code.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    It's not the recommended way to deal with documents on iOS now days. But the Runtime portion of Codea is a bit old-fashioned and expects stuff to be on disk immediately for the project-editing APIs.

    The ideal way to work would be to use the in-memory representation entirely in the runtime, and editing the project just behaves like any other document editing operation in the code editor. That's where I'd like to get things.

    It's also possible to open Codea documents from other locations now (such as another app like Working Copy, or from a USB drive, or iCloud, etc). Saving might take a long time if your document is on iCloud, or worse, it could fail (you unplugged the USB drive, for example).

    The way it works is that there is a process monitoring changes to the document, and a background daemon which ensures that the document is saved. Other processes might also be interested in the document, and asking to save the document in Codea would tell those processes to save their changes first, which could add delays.

  • Posts: 1,392

    @Simeon - just tried to use Air code on 179 and Codea bombs straight back to iPad apps screen. Switched Airplay on and off no change. Have you modified this recently?

    I have been playing around with WebDav - could that affect it?

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @Bri_G it does crash straight away! I'll look into it, I haven't touched it but I must have done something

  • SimeonSimeon Admin Mod
    Posts: 5,054

    Fixed the Air Code issue, thank you for the report

  • Posts: 1,392

    @Simeon - thanks for the update, have been trying to use WebDAV to use external editors on my Mac. But ran into a brick wall, couldn’t get a proper link. Couldn’t get the Davify Codea package to install from the zip file. Eventually had to copy and paste Davify in, but running it still wouldn’t give me access. Also trouble with WorkingCopy.

    I’ll shelve this for a while, until you next update, and work on my latest project. I’ll be getting in touch with you about that later. Thanks again.

  • Posts: 1,392

    @Simeon - 179 giving problems with formatting of comments again - see photo below.

    I have already taken out a couple of — formatters from within the —[[ and —]] the touch routine with no effect. There was no red error bar before I put in the paragraph comment fields.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @Bri_G does the problem persist if you close and re-open the project?

  • edited August 21 Posts: 1,392

    @Simeon - yes - also the error bar, see attached photo, is giving a false error.

  • Posts: 1,392

    @Simeon - new editor, drop down list of tabs - when you switch tabs top tab (usually Main) is red. Select another tab and current tab is green, top tab red an rest black. Is this the intended color scheme?

  • edited August 21 Posts: 1,392

    @Simeon - Aha, is it red because there is an error there - if so just ignore the question.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @Bri_G any way I could get that project from you to see if I get the incorrect highlighting too? Would love to fix

  • Posts: 1,392

    @Simeon - very big project, and a bit of a mess at moment, so I started stripping out code that didn’t influence the error and combined into one tab. Error still present. Not sure how you can play with this - I will be sending the full code to you later when finished, but hopefully free from errors. Trying to attach as a zip.

  • SimeonSimeon Admin Mod
    Posts: 5,054
    Thank you! I was able to open it straight from the zip into Codea on my phone and I can see the error
  • SimeonSimeon Admin Mod
    Posts: 5,054
    Ohh I see the bug in Codea. It’s the double bracket `]]` in the line ending `rotMats[face[chkbut]])`. If you put a space between those two for now `] ]` it will fix the highlighting until I can fix this properly
  • edited August 22 Posts: 1,392

    @Simeon - great, I thought it may have been down to control codes for text formatting. I'm sure I've used that before without problem problem. Then again it may have been something like data[table[table2].x] - how deep can you nest these? I need to get better with tables.

    By the way, thanks for the Aircode update, will be testing later.

  • Posts: 1,392

    @Simeon - Aircode working fine now. Thanks again.

  • SimeonSimeon Admin Mod
    edited August 22 Posts: 5,054

    @Bri_G surprisingly, your snippet of code is highlighted correctly

    Lua treats the double ]] as the end of the multi-line comment, even when it's matching other brackets inside the comment. So Codea is highlighting this correctly. The code will error in the Lua interpreter

    If you try paste this code

    print("Hello World!")
    --[[
    local tbl = {}
    local lookup = { bar = "foo" }
    tbl["foo"] = 55
    
    print(tbl[lookup["bar"]])
    --]]
    

    Into the Lua interpreter on the official web site here: https://www.lua.org/cgi-bin/demo

    You'll get an error input:7: unexpected symbol near ')'

    If you want to change your commenting style, you can place an = sign between the comment brackets, and then Lua will match to the closing brackets containing the same number of equals signs

    This will highlight and run correctly:

    print("Hello World!")
    --[=[
    local tbl = {}
    local lookup = { bar = "foo" }
    tbl["foo"] = 55
    
    print(tbl[lookup["bar"]])
    --]=]
    
  • dave1707dave1707 Mod
    Posts: 7,912

    @Bri_G See this link about comments. You can have a lot of nested comments by using matching equal signs between the starting and ending square brackets. I don’t know if there’s a limit to the number of equal signs that can be used.

    http://www.wellho.net/mouth/4271_Line-block-and-nested-comments-Lua-compared-to-other-languages.html
    
  • edited August 22 Posts: 1,392

    @Simeon, @dave1707 - thanks for the link and info, never seen that before. Also, never thought to look up commenting in Lua as I thought the two options were the only ones available.

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon Here some code that causes the left justification error.

    1) Run this code with the Save and Run option
    2) Exit back to the editor
    3) Add function somename() at the bottom and press enter
    4) The cursor is left justified and the end keyword isn't added.

    function setup()
        saveProjectTab("ggg","--qwerty")
    end
    
  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 thank you for those steps, managed to fix that for next build

  • SimeonSimeon Admin Mod
    Posts: 5,054

    (I'm going with version 3.0 as the marketing version of this release as it will include the new code editor and iPhone support)

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon Looks like the indentation bug is fixed. Not sure about the new icon yet. I'll give it a few days.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 I'm not sure either, but I'd really like a change as it's been many years with the old one.

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon How about an image something like this for the icon.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 it will probably change wildly over the next couple of betas until I can figure something out. This is where I'm up to now. I'm leaning towards A

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon Of the ones you have there, A looks the best. What would C look like if you had CODEA in white across the middle. Or maybe D with small odea inside of the big C.

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon In Version 183 on my iPad Air, when I tapped on the TwoLivesLeft icon at the bottom center of the Codea home page, it shows the Credit screen. Above the word Credit it says Unable to validate receipt. No receipt available. On my iPad Pro still on version 167, it says Your version of Codea 1.3.6 was purchased on May 24, 2012. I don't recall seeing those before, but then it's been awhile since I looked at that page. Is that something you're going to start using for something in an upcoming version.

  • SimeonSimeon Admin Mod
    edited August 26 Posts: 5,054

    @dave1707 I'd like to make Codea free with an in-app-purchase to unlock editing functionality (like Shade). But I would want anyone who previously purchased Codea to get those features unlocked for free, automatically

    I put a little label in there to try to determine when people purchased so I could unlock editing features based on that

    Edit: So in the real App Store version, you're getting the correct result, interesting! I couldn't get it to work before

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon That sounds useful, a free Codea runtime. That would allow people to run someone else's projects without having to go through the App Store. I'm just trying to think of what issues there might be. I guess whoever shares their code is responsible for crashes or will there be something in Codea to trap crashes. That will also open up the code on the forum to anyone who loads free Codea. Wasn't there a free version of Codea a while back that let you run code but not save it or only save so many lines of code.

    That should also lead to more Codea sales if free users get hooked.

    Would someone be able to copy code from the forum and run it. If they can, couldn't they modify the code in Notes and run it.

    Just thinking about things before I know what's really happening.

  • @Simeon I highly discourage IAP or DLC as this opens you up to Pirated/Tweaked versions or aka Lost Revenue. Having a free Version isn’t a bad idea and potentially could help sales by allowing a new user to experience Codea in a simple form.

    I say this with full understanding of this community as I have developed some of the tweaks many users use today JB or non-jb to alter values held in registries at runtime and so forth.

    And to give you an example it took me less than 35 minutes to crack, dump headers, and patch the binary in IDA for full node and export access of shaders.(This was only for security testing purposes and will never be publicly released)

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @AnonymousX thanks for the info! Surely Codea can be pirated as easily as Shade though?

    I guess I don't really mind if people are choosing to pirate our apps. My hope is that they will choose to support development instead, but really it's their choice

    My reasoning for moving to a free trial like Shade is that I'd like people who purchase Codea to be people who actually use the app. That is, I'd like to avoid instances where someone purchases Codea by paying upfront and then realises they don't use it very much. Having a free trial lets people make a more informed decision

  • I totally agree but I was saying doing something more like Codea-preview verses a fully functional version with IAP that could be hacked.

    At this time it looks like the lates cracked version is 2.5.1 so that’s good it’s so behind.

    Having a pay AND a free version makes it so not any self per claimed “hacker” can’t just swizzle some methods in the free and unlock it, they have to at least purchase the full version. So by putting out a light version with some functions and frameworks missing it makes it not worth the trouble it that makes sense. Then you could put purchase button to openurl to Codea Pro 3.0 in AppStore

    Your call but wanted to put in my 2 cents.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    Thank you, that is good advice. I didn't realise the latest cracked version was so far behind

    I'd love to try cracking my own software in IDA some time (I expect it would be easy since I didn't really try to do anything except ensure the experience for paid users was smooth and bug-free). I haven't used it for many years and it would be interesting to see it from that perspective

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon When I've been seeing the new icon on the screen, to me it looked like a fancy sideways g. So now that's what I always see, a sideways g, not Co.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 haha I saw that a few times too. I'm considering separating the letters a bit but I'd rather it not look like letters at all.

  • dave1707dave1707 Mod
    Posts: 7,912

    @Simeon When I open my Dropbox folder, it shows a list of the files across the screen and then switches to a single column list of the files. Can you change it so it doesn't show the list across the screen if it's just supposed to be a single column list. Also, if I close the list and open it again, it shows the list across the screen and not a single column.

  • dave1707dave1707 Mod
    edited September 14 Posts: 7,912

    @Simeon Is there a way to get access to the Wi-Fi signal strength. There are apps that do it, but each time you want to update the screen as you move around the house, you have to watch a 5 second ad before it continues. Also, is there a reason you don't have code to access a lot of the iPad information, such as battery level, cpu %, etc.

    PS. It would be nice to have my own program to show information about my iPad instead of loading different apps to see the info.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @dave1707 Oh I see the popover initially starts out very large, I'll look into that.

    On device information, I've updated the deviceMetrics API for the next build to include batteryLevel and batteryState (as well as a few other fields)

Sign In or Register to comment.