Codea 2.7.5 (145)

I created a project in Codea. Copied it to the iCloud Drive . Did a Codea edit on the iCloud project. Closed the project. I was still in the Codea project list. Looked at the project and that didn’t have the changes. Had to go to the iCloud Drive and the changes were in that project. When the editor closes, shouldn’t it stay with the project that was edited. I guess that also means you can have multiple projects with the same name.

Tried the Export Projects. After creating the zip file, I looked at what was in it. I noticed that it contained the Dropbox asset folder. Also, when I tried the export of the zip file back to Codea, Codea eventually crashed before it showed the projects to restore.

@dave1707 any external projects will not show up on the main screen project list (for now). You’ll have to open them for editing from the Files app. The one in your project list just happened to have the same name as an external project.

Thanks for finding the dropbox asset bug, I will test the re-importing. I may have broken it. How did you try to re-import your zip file? From the files app? From somewhere else?

@Simeon I have the zip file in a folder in the Dropbox app. From there I did an export and selected Codea to receive it.

As for the external project, I created a project named 000 in Codea. I went to the Files app and copied that project 000 to the iCloud Drive. From the iCloud Drive, I selected it to open with the Codea editor. I made a change and closed the editor which left me in the Codea project list. I looked at project 000 there and it was still the original project. I went to the iCloud Drive and looked at project 000 there and it contained the changes. So I have 2 projects named 000, one with changes and one without. Is that how you see it working. I don’t mind the 2 projects, I just didn’t like being left in the Codea project list instead of the iCloud file where I started the editor.

@Simeon I came across something that I hope you can change. This has been there for awhile. If I’m making changes or adding code in a project, I noticed that the autocomplete line hides some keys. For instance, if I key the variable b and I want to multiply it by some value, I press the ±*/ key which brings up a group of options to select. The problem is the bottom area is hidden by the autocomplete words. I then have to guess where the * or + or one of the other options is when I select it.

PS. Maybe you can lighten the color of the autocomplete so the background options show thru.

Ohh thanks for catching the autocomplete overlap bug. I’ll change it so it appears on top

Yeah the editing external projects (for now) will not show the projects in the main editor. I’d like to include them in the main editor under a section called “External” or something so you can easily find them again.

@Simeon I tried moving the zip file from the Dropbox app to the icould Drive. I did a Share and selected Codea. The list of projects came up and I selected a project to import. That worked OK. So I’m not sure why it works from the iCloud Drive and not from the Dropbox app.

@Simeon I selected Share on the zip file from the Dropbox app and the restore worked. Not sure what the difference is with selecting Share or Export.

Strange, I’ll give it a try.

@Simeon The autocomplete with popup keyboard buttons works great. Thanks, that was kind of annoying.

@Simeon Codea still crashes on changes. When I’m trying to understand how some code is working, I’ll edit the code, make a simple change, execute the code. After several of those quick cycles, around 6 or so, Codea crashes. Sometimes it’s when I execute the code, sometime when I’m keying changes. It’s not just this version, but has been happening for awhile. I think I mentioned this before, but I don’t know if you haven’t found the cause or you forgot about it. It’s not a big deal, but Codea still shouldn’t just crash.

PS. This is playing with voxels.

@dave1707 I would really like to sort this out, any particular project that triggers this a lot? Would the voxel example projects be a good test case for me to start to reproduce your issue?

I’ve been developing in Codea lately and haven’t encountered this — but I’ve mostly been on 2D stuff.

@Simeon I’ll see if I can put together an example that does it consistently.

@Simeon Here’s a stripped down example that crashes Codea after about 7-8 restarts. It crashed the last 3 times I tried it. Run the code and while it’s drawing the terrain, stop the code to go back to the editor. Run the code again stopping it before the terrain finishes. Keep doing that cycle and after about 7-8 times it crashes for me. Usually in the code I’m working on, I’ll be making code changes and running it to see what happens. Sometimes Codea will crash while I’m in the editor making changes, other time when it executes the code. This is on a 16gb iPad Air with the latest code of iOS and Codea.

--# Main

function setup()"scene.voxels.generatingChunks")
    scene = craft.scene()   
    allBlocks = blocks()  
    size = vec3(nbr,1,nbr)
    coordinates = vec3(size.x/2 * 20, 70, size.z/2 * 20)    
    v =, vec3(size.x/2 * 20, 130, size.z/2 * 20), 400, 70, 2000)

    scene.voxels.coordinates = coordinates 
    scene.voxels:generate(readProjectTab("Generation"), "generateTerrain")


function update(dt)

function draw()

function createCloud(x,y,z)    
    local c = scene:entity()
    c.position = vec3(x,y,z)
    local v = c:add(craft.volume, 25, 25, 25)
    local cx, cy, cz = v:size()
    local white = color(255, 255, 255, 255)
    local f = 0.07
    local power = 4
    local wx = craft.noise.perlin()
    wx.seed = x
    wx.frequency = f
    local wy = craft.noise.perlin()
    wy.seed = y
    wy.frequency = f 
    local wz = craft.noise.perlin()
    wz.seed = z
    wz.frequency = f 
    local r = 9
    local r2 = r*r
    for i = 0, cx-1 do
        for j = 0, cy-1 do
            for k = 0, cz-1 do
                local ox, oy, oz = wx:getValue(i,j,k), wy:getValue(i,j,k), wz:getValue(i,j,k)
                local dx, dy, dz = cx/2 - (i + ox * power), cy/2 - (j + oy * power), cz/2 - (k + oz * power)
                local d = dx*dx + dy*dy + dz*dz
                if d < r2 then
                    v:set(i,j,k, BLOCK_ID, 1, COLOR, white)  
    c.scale = vec3(1,0.5,1)
    return c

--# Generation

function generateTerrain(chunk)
    cx, cy, cz = chunk:size()
    SEA_LEVEL = 10    
    -- block types as noise sources
    air = craft.noise.const(0)
    grass = craft.noise.const(chunk:blockID("Grass"))    
    local n = split(air, grass, SEA_LEVEL)
    n = warp(n, hills(40))  

-- take two noise functions and split based on elevation
function split(a,b,depth)
    depth = depth or 64    
    local s =
    s:setSource(0, a)
    s:setSource(1, b)   
    s:setSource(2, craft.noise.gradient()) 
    s:setBounds(1.0 - depth / (cy + 0.0), 1.0)    
    return s

-- warp one noise function using others
function warp(input, d1, d2, d3)
	if d1 and d2 and d3 then
		local zero = craft.noise.const()	    
	    local displace = craft.noise.displace()
	    displace:setSource(0, input)
	    displace:setSource(1, d1) -- x
	    displace:setSource(2, d2) -- y
	    displace:setSource(3, d3) -- z
        return displace
		local zero = craft.noise.const()	    
	    local displace = craft.noise.displace()
	    displace:setSource(0, input)
	    displace:setSource(1, zero) -- x
	    displace:setSource(2, d1) -- y
	    displace:setSource(3, zero) -- z
	   return displace

-- generic hills (height map style)
function hills(height, offset, frequency, octaves)    
    height = height or 10
    offset = offset or 0
    octaves = octaves or 5
    frequency = frequency or 0.25    
    local heightNorm = height / (cy + 0.0)    
    local shape = craft.noise.perlin()
    shape.octaves = octaves
    shape.frequency = frequency        
    local shape2D = craft.noise.scale(1,0,1)
    shape2D:setSource(0, shape)    
    local shapeFinal = craft.noise.scaleOffset()
    shapeFinal:setSource(0, shape2D)
    shapeFinal.scale = -heightNorm * 0.5
    shapeFinal.offset = -heightNorm - offset/cy ---heightNorm*2      
    return shapeFinal

@Simeon I tried the above code on my iPad Pro and it didn’t crash Codea. On my iPad Air it crashes every time.

@dave1707- is this a memory problem. What memory is in your Pro and iPad air? When you say crashes every time on the air do you mean 1 start or 7 or 8 starts?

@simeon with my stuff (mainly 3D) i can almost guarantee that Codea will crash the fifth time i start the program (during the setup). Works fine 4 times in a row!

@simeon i find the camera recording works first time, but if i try to do it the second time it will yield just a grey screen when i stop the recording.

This will be fixed in the next beta

@dave1707 thank you for that! I’ll see what’s going on in that example

@piinthesky sounds like it could be related to the issue dave1707 has