Howdy, Stranger!

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

Codea Craft 2.5 (90)

dave1707dave1707 Mod
in General Posts: 8,464

Codea Craft is now live. Report any issues here.



  • em2em2
    edited October 2017 Posts: 194

    I am still experiencing some bugs from the previous version.

    • Indentation does not work properly in a freshly opened project
    • Autocorrect/suggestions in the code suggestion bar do not expand properly when used for tables or classes
    • [Possible bug] "Get started" pop up does not appear on first run
    • Keyboard in Codea reference (outside project) search appears and disappears randomly
    • Searching for output in the reference reveals two identical results
    • The new print introduces unnecessary animation to the console
    • Opening data uris in Safari does not work
    • @UberGoober :

    Am I just SOL with an iPad [3] this old?
    Error message is the same every project:

    [string "-- Craft Scenes..."]:28: bitset to_ulong overflow error
    stack traceback:
        [C]: in method 'draw'
        [string "-- Craft Scenes..."]:28: in function 'draw'
    It seems like I might be able to manually fix it if it's just that one line....
    • Online reference (and possibly website) should be updated to reflect the new craft update.
  • em2em2
    edited October 2017 Posts: 194

    Another question (sort of like a bug):
    Why can't projects in the new project packs be read with They are impossible for me to find in the Codea filesystem.

  • Is this for legacy issues too, or just Craft-related?

    The legacy bug I run into most often regards commands that bring up the little highlighted parenthesis, the ones which can be tapped to access the file system or other windows--like color() and readImage().

    The parenthesis don't highlight if the commands are called inside other commands. For example:

    variableFoo = color()

    That will bring up the highlighted parenthesis, as expected.


    That does not.

    Sorry if this thread isn't for that kind of bug!

  • SimeonSimeon Admin Mod
    Posts: 5,387

    @em2 thank you for the bug list. The indentation one is my fault and is because the editor is quite slow to "catch up" on processing a new file.

    @UberGoober that's a long-standing bug but I agree it should be fixed. The problem might be, what do you do if you nest two commands which use that feature?

    A nonsense example would be, what do you do if you have color(color())?

  • em2em2
    Posts: 194

    @Simeon Possibly prioritize the inner command?
    Another bug that has been bugging me is that repeat ... until loops do not indent correctly.

  • SimeonSimeon Admin Mod
    Posts: 5,387

    @em2 good idea, and who uses repeat until? (I'm kidding I should fix that)

  • From my Ipad mini 1, ios:9.3.5, I got the error : bitset to_ulong overflow error from every Craft examples.

  • SimeonSimeon Admin Mod
    Posts: 5,387

    @moechofe2 sorry about this, seems to be an issue with 32 bit processors that we'll need to resolve.

  • dave1707dave1707 Mod
    Posts: 8,464

    @Simeon When using search, tapping on each highlighted word sometimes scrolls the code to the line of the word, sometimes it takes you past the line containing the word, sometimes it takes you to the beginning of the code and sometimes it’s just shows a blank screen.

  • edited October 2017 Posts: 557

    @Simeon What makes sense to me is that you should only be able to tap on a () field if, by tapping it, you'd be replacing its contents with equivalent information.

    This seems like possibly a good case in point:

    color(color(240,0,0,255).r, color(0,240,0,255).g, color(0,0,240,255).b, 0) 

    (and yes I know that's fully transparent, that's the joke. :p).

    Inside each of the nested color(...) statements are simple color values, so tapping them and selecting from a color wheel would replace them with equivalent information. But inside the outermost color(...) statement are calculations of color values, not direct values, so replacing them would lose user information without notice. Maybe that's a good way to check?

    In the same way:

    local image1, image2, image3
    prefix = "Project:"
    imageName1 = "GoodImage"
    imageName2 = "BetterImageImage"
    image1 = readImage(prefix..imageName1)
    image2 = readImage(prefix..imageName2)
    image3 = readImage("Dropbox:BestImage")

    It seems to make sense to me that only the last one should be tappable, in this case. Even though the first two aren't nested, they have shall we say "original content" inside them, whereas the last one has content that can be replaced and restored by a tap.

    Maybe that's the key principle: if the information can be restored by a tap, it is valid that it can be replaced by a tap. Simple color values could be replaced and restored by tapping the field. The same with a string value that references an image, like "Dropbox:BestImage": it could be replaced by tapping the field and browsing the file browser, and it could be restored, to the letter, by tapping the field and browsing the file browser.

    Sorry to go on and on! Just a thought.

  • FWIW, I totally agree with @UberGoober about when () should be tappable.

  • dave1707dave1707 Mod
    Posts: 8,464

    @Simeon Here’s something strange I ran into. See the image below. I’m missing lines 62 thru 68. I selected a group of lines I was going to delete when I noticed the missing lines. They still didn’t appear when I cleared the selection. They eventually came back when I scrolled them off screen and then back on screen.

  • em2em2
    Posts: 194

    @dave1707 I encounter the same bug when editing large files for a long time. You have to restart the app to get it fixed.

  • em2em2
    edited October 2017 Posts: 194
    • My Dropbox files are also not listed alphabetically.
    • Codea project import stopped working. After trying to import a few files which crashed the app, nothing shows up when I use "Open in..." from other apps.
    • needs to be updated—from browsing the filesystem with I noticed that some things have changed.
  • em2em2
    edited October 2017 Posts: 194

    Small requests:

    • Non-wrapping lines in the editor
    • Code folding
    • Project list view
  • em2em2
    Posts: 194

    More bugs:

    • pointSize is a useful function, but it is neither recognized by "autocorrect" (if I may call it that) nor highlighted properly.
    • getmetatable is not highlighted properly.
    • When trying to index the quat table, I found this strange error:
    member function 'class<quat>.__tostring' can not be access by const object
    stack traceback:
        [C]: in ?
        [C]: in function 'tostring'
  • dave1707dave1707 Mod
    Posts: 8,464

    @Simeon Here’s another thing I ran into. It only seems to happen on the first try. Open an existing project that has a lot of lines. Scroll to the bottom of a tab. Select a section of code. The code scrolls to the beginning of the code or scrolls so far down that the screen is blank. You then have to scroll back to the code you selected. If you select code after that, it seems to work OK.

  • dave1707dave1707 Mod
    Posts: 8,464

    @Simeon Voxel assets that are saved in the Documents folder aren’t shown. I think the names of all files saved in any folder should be shown.

  • JohnJohn Admin Mod
    edited October 2017 Posts: 622

    @dave1707 I agree, this is a known issue and will be fixed.
    Edit: the missing assets

  • dave1707dave1707 Mod
    Posts: 8,464

    @John Which one of my issues are you referring to, the missing lines, the selected lines, or the Voxel asset not showing.

  • Posts: 122

    @Simeon braces with == signs are not changing the color of code inbetween them, and getmetatable is not yellow

    IMG_9615.PNG 98.7K
  • em2em2
    Posts: 194

    @xThomas I kinda like the -[==[...]==]-- braces bug. It allows you to edit code that is commented out with proper indentation and syntax highlighting.
    The yellow color [syntax highlighting] on getmetatable is a bug, which I also described a few posts above.

    @dave1707 from my inference, @John is referring to the Voxel Assets issue.

  • em2em2
    Posts: 194

    More bugs:

    • Try this: open a file long enough so that you can scroll in it. Open the search field to find something. While scrolling the text, tap on a match in the sidebar. Continued tapping will scroll in increments but never to the matched text.
    • Very small pixel sprites (9x11) do not show up in the asset preview panel. Maybe they should be resized up so that they can be seen. Otherwise they are practically invisible

    If you don't understand, I'll try to post GIFs of what I mean.

  • SimeonSimeon Admin Mod
    Posts: 5,387

    @em2 thanks so much for the continued reports. It's appreciated

  • em2em2
    edited October 2017 Posts: 194

    Question: is split-screen support planned?
    @Simeon I'm glad to help, especially so that you can have these issues fixed soon. Codea is such a great product and little nuances can really irritate.

  • Posts: 1,757

    @Simeon , @John,

    Now managed to resolve problems with most of my .obj files. Some trivial like .png file for texture spelling error - in that case shows untextured model. Blender models work consistently. Errors given on some files in the print output window. Most failures down to a utility for conversion of .dat files to .obj files. Must be a formatting error in the data - there does seem to be a number of different formats for the .obj file - have you covered them all in your loader?

  • Posts: 4

    Here's a bug:
    Importing projects crashes the app.

  • em2em2
    edited October 2017 Posts: 194

    More suggestions

    • readImage on retina devices should have a "force" option or something similar to disable @2x files.
    • A great addition to the close and physics.pause functions would be pause and restart functions.
  • SimeonSimeon Admin Mod
    Posts: 5,387
    @em2 I have a development branch with split screen support. It’s basically a rewrite of every major part. It’s getting there!
  • Posts: 490

    I'm also getting the bitset to u_long on an iPad4 (not air).

    Could the beta be updated to version 90? It's currently on 88 and the App Store won't let me install the published version over the top and I don't want to risk uninstalling - too many projects going back many, many years! (Yes, I know I can export and reimport but I worry about stuff like shaders with that.)

  • dave1707dave1707 Mod
    Posts: 8,464

    @LoopSpace To load the latest non beta version, you first have to go to purchases and load the old version of Codea over the beta version. Then you can load the updated version from the update screen over the latest non beta version.

  • em2em2
    Posts: 194

    @Simeon excited about that!

    @LoopSpace backing up your device to iTunes will preserve all your data. I checked the iTunes backup file system to verify. Backup browsers can extract the files individually.

  • Posts: 490

    @dave1707 That's what I tried. I'll try again. @em2 I know that there are ways and means ... but I have a lot of code invested in Codea and I'm being cautious.

  • Posts: 490

    @Simeon Can the metatables for quat and craft.model be made mutable (just like vec4 and so on are)? I've built up a variety of shapes with meshes which I'd like to convert to models and I'd like to be able to call them as, say, craft.model.pyramid(). Similarly, my quaternion library contains a bit more than yours so I'd like to add my extras but retain using the underlying quat structure.

    I'm also trying to understand the difference between the old mesh and the new model. The new model separates the roles of the vertices and the triangles (does this significantly improve performance?) but are there any other differences? I did try assigning a mesh as a model to test!

  • Sweet Jeebus but that there Craft is nice. My wife has an iPad Pro, and I snuck Codea on it to take a look. That is some great stuff. Can't wait till I can play with it.

  • SimeonSimeon Admin Mod
    Posts: 5,387
    @LoopSpace in the settings panel there is an "Export All Projects" button that will give you a zip archive of everything. We're working on a fix for 32 bit devices. Sorry about that
  • Posts: 490

    @Simeon does it do shaders as well?

    More on the quats: it doesn't seem possible to set a quat via: quat(.5,.5,.5,.5) (note that this is a valid rotation quaternion) as it complains about ints. Rather, I have to do q = quat() and then set each of q.x etc individually.

    Any thoughts on the metatables?

  • JohnJohn Admin Mod
    Posts: 622

    Hi everyone

    I've found the source of the to_ulong() overflow error. This was due to 32 bit long integers being too small on 32 bit devices causing an overflow. I think i've fixed this and will be putting out a build soon.

    You should be able to add new functions (i.e. craft.model.staticFunction(), craft.model:method()) to a class by doing the following:

    local modelMeta = getmetatable(craft.model)
    rawset(modelMeta, "myStaticFunction", function() <code> end)
    rawset(modelMeta.___class, "myClassMethod", function(self) <code> end)

    I've also fixed the issue with the quat class, which was incorrectly expecting ints in the constructor. Now it should work with float and anything not supplied is 0 by default.

  • AnatolyAnatoly Mod
    Posts: 889

    Codea Craft AR: Clicking Shelf returns error

  • Posts: 490

    @John that's great on all fronts.

    Can I suggest that quat() with no arguments defaults to quat(1,0,0,0) as the identity rotation?

  • JohnJohn Admin Mod
    Posts: 622

    Version 2.5.1 should now be available for beta testers. Let me know if it resolved any issues.

  • JohnJohn Admin Mod
    Posts: 622

    @LoopSpace That's a good idea. I'll change that for next build.

  • Posts: 490

    @John I just got an email saying that version 2.5(88) was available on Testflight, but that's the version I already have installed. Are you sure you uploaded the right build?

    The rawset method doesn't seem to be working with quat for methods (haven't tried for static functions) as there's no ___class item in the metatable.

    Also for quat, you can't define a quat until in setup (presumably something to do with setting up the GL context) which is a bit annoying for defining stuff before setup.

  • Posts: 490

    When I try to create a block based on Surfaces:Desert Cliff then the block looks as though it's been exploded: each face is moved out from the centre (looks like a factor of 2).

  • dave1707dave1707 Mod
    edited October 2017 Posts: 8,464

    @LoopSpace I tried all of the Surfaces:Desert Cliff and they were all OK. Can you make a simple example showing what’s wrong.

    EDIT: Here’s an example of a cube with the different Surface images. Slide the surface parameter for different surface images.

    function setup()
        tab={"Surfaces:Desert Cliff AO","Surfaces:Desert Cliff Color",
                "Surfaces:Desert Cliff Height","Surfaces:Desert Cliff Normal",
                "Surfaces:Desert Cliff Roughness"}    
        scene = craft.scene()
        scene.sun:get(craft.light).color = color(255, 191, 0, 255),100,150),100,150)    
        cube = scene:entity()
        cube.model = craft.model.cube(vec3(1,1,1))
        cube.material = craft.material("Materials:Specular")
        cube.material.offsetRepeat = vec4(0,0,1,1)   ,0,-6)      
        parameter.integer("surface",1,#tab,1,function()[surface]) end)
    function update(dt)
    function draw()
  • dave1707dave1707 Mod
    Posts: 8,464

    @Simeon @John Is there some way to show the value of a variable in the chunk of code used in voxels:generate. Using a print statement does nothing and shows nil.

  • Posts: 69
    @LoopSpace can you show me an example of a custom generated mesh. For some reasons the faces if my mesh always face inside, even if i flip all normals.
  • Posts: 69
    @John @Simeon I found a bug. Normals of a model do not have an effect on wich side of a triangle is visible. This means if i Invert all normals of a model its still visible from the same side.
  • Posts: 490

    @GR00G0 My mesh extension library can be found on github. It adds a whole slew of extra shapes which can be invoked via something like:

    m = mesh()

    I'm looking at adapting these into models for use with Codea Craft.

    @dave1707 Those images are meant to be used all together to make a realistic surface. I had to look up "aoMap" (Ambient Occlusion, apparently) but the others are pretty obvious.

    Try cube.material = craft.material.preset("Surfaces:Desert Cliff"), like in the example project.

    Looking more closely, the offset isn't a factor of 2, for a block with size vec3(1,1,1), the offset is 0.25.

  • Posts: 490

    @John ignore what I said about quat and rawset. It is working.

    One more on quat, its metatable is having an identity crisis: it thinks it is itself a quat:



    expect userdata, got table ... in function 'tostring'

    for the second one. This is a bit annoying because comparing metatables is a reliable way to test the type of a userdata, but the metatable of quat uses the __eq method of a quat rather than of a table.

This discussion has been closed.