Beta 2.1 (1)

Thanks @dave1707 I didn’t realise there was tracking behaviour on the switches. Will fix.

####Bug:
There is a problem with httprequest + loadString: http://codea.io/talk/discussion/comment/49295#Comment_49295
We found a turnaround: http://codea.io/talk/discussion/comment/49301#Comment_49301
which is to delay the loadstring with tween.delay, but this is not really good.

documentation for savetext uses ‘contents’ and ‘text’ for the second argument.

The documentation browser issue is still there, but seems to appear after I’ve had Codea running for a while. It just happened again - and once it does then it does every time - but killing Codea and restarting stopped it.

If text is too big to fit on the screen then it isn’t shown at all. This is very confusing.

@Andrew_Stacey thanks for pointing out the documentation bug. Will look into how the browser can get stuck.

What do you mean by “if text is too big to fit on the screen” — is this relating to the documentation browser still, or something else?

No, when displaying a string using text.

encountered a crazy weird bug where every time I hit enter or space it would add it at the top and move my cursor there, but then when I hit backspace my cursor jumped back to its previous position and deleted a character there, as well as the keyboard being stuck up and refusing to go away

@JakAttak are you able to reproduce it?

#####Bug (minor).
When recording a video, if the project restart(), the screen still shows as recording, while it is not recording any longer.

@Simeon, haven’t reproduced in yet, but I’m fairly certain it has something to do with the caret shifters

####Bug:
This seems to be linked to a bug i have described above:
When i update a library with.

  • http request.
  • then loadstring()() defines f
    then to have f running i must do tween.delay(…). This was bad but ok.
    Now i have a much worse problem:
  • one of my f functions is an update function that contains a loadstring()()
  • this one doesnt work at all, even with a tween.delay.
    Could you have a look? This is really causing a problem in my codea showcase program: the library update function doesnt work for my users. (NB: i have a containement, but which is not really nice)

#####Question:
with the new way codea runs a project, is it possible to modify the touched() function while running?
My question is again fom codea showcase, where i get a new touched() function from loadstring() and i assign it to replace the current touched() function. It seems to work, but it seems the old touched() function is still called too, which causes bugs. This could be a bug on my side, although i dont see it yet (my code is rather clear on that point).

[edit] no, it works correctly. The pb was on my side because i assumed all projects had a touched() function, which is not the case, and that would cause my bug.

Bug:
If you have a big project that takes time to compile, pressing the X at the bottom left of the screen crashes Codea, instead a good idea would be to have it cancel the compile, at the moment it tries to quit to the main screen then crashes.

Strange behaviour of line with linewidth near to 1, seems to be due to smoothing:

function setup()
    parameter.integer("sc",1,20)
end

function draw()
    background(40,40,50)
    lineCapMode(SQUARE)
    scale(sc*2)
    stroke(252, 252, 252, 255)
    for k=1,10 do
        strokeWidth(k/sc)
        line(k*20/sc,0,k*20/sc,100/sc)
    end
end

Codea overwrites the pasteboard:

I copy something in another app, or in the forums, and when I come back to Codea it is overwritten by the last thing I copied in Codea.

####Bug (big):
i had in mind that in the previous versions of codea

    if not t.state == BEGAN then return end

meant

    if not (t.state == BEGAN) then return end

but now it means

    if (not t.state) == BEGAN then return end

If i am correct this is a huge change!

editor bug:

the colored dot appears randomly.
try that code, pop up the keayboard, tap a places, remove keyboard, scroll. Some dots appear, some dont. Changes every time.

function PolarAnim:colorCycle()
    self.blend = self.blend + .01
    if self.red then
        local c2 = color(255, 0, 0, 255)
        local c1 = color(255,127.5,0,255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.red = false
            self.orange = true
        end
        elseif self.orange then
        local c2 = color(255,127.5,0,255)
        local c1 = color(255,255,0,255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.orange = false
            self.yellow = true
        end
        elseif self.yellow then
        local c2 = color(255,255,0,255)
        local c1 = color(127.5,255,0,255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.yellow = false
            self.yellowgreen = true
        end
        elseif self.yellowgreen then
        local c2 = color(127.5,255,0,255)
--        local c1 = color(0,255,0,255)
        local c1 = color(0,255,255,255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.yellowgreen = false
--            self.green = true
            self.teal = true
        end
        elseif self.green then
        local c2 = color(0,255,0,255)
        local c1 = color(0, 255, 127.5, 255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.green = false
            self.seafoamgreen = true
        end
        elseif self.seafoamgreen then
        local c2 = color(0,255,127.5,255)
        local c1 = color(0,127.5,255,255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.seafoamgreen = false
            self.teal = true
        end
        elseif self.teal then
        local c2 = color(0,127.5,255,255)
        local c1 = color(0,255,255,255)

        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.teal = false
            self.skyblue = true
        end
        elseif self.skyblue then
        local c2 = color(0,255,255,255)
        local c1 = color(0,0,255,255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.skyblue = false
            self.blue = true
        end
        elseif self.blue then
        local c2 = color(0,0,255,255)
        local c1 = color(255, 0, 255, 255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.blue = false
            self.purple = true
        end
        elseif self.purple then
        local c2 = color(255, 0, 255, 255)
        local c1 = color(127.5,0,255,255)

        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.pink = true
            self.purple = false
        end
        elseif self.pink then
        local c2 = color(127.5,0,255,255)
        local c1 = color(255, 0, 127.5, 255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.fuscia = true
            self.pink = false
        end
        elseif self.fuscia then
        local c2 = color(255,0,127.5,255)
        local c1 = color(255,0,0,255)
        self.col = c1:mix(c2,self.blend)
        if self.blend >= 1 then
            self.blend = 0
            self.red = true
            self.fuscia = false
        end
    end
end

readImage,sound and color do not show the highlights that allow you to bring up the image/sound viewer or colour wheel when closed in another function call such as:

imgb = ImgButton(vec2(WIDTH/2,HEIGHT/2),readImage(),...

Imgbutton being a class of mine, this means I cannot look for an image without having readImage() outside of the call and then copying and pasting it back in. Same applies to colour and sound. This probably isn’t a bug but I thought it was worth mentioning.

@luatee this has been like that for ever. I usually manage this (although annoying) with an extra local variable.

@Jmv38 Yes I thought it had, that’s also what I do sometimes.

I’m having a lot of trouble trying to distinguish Codea bugs from iOS 8 bugs, but I’ve noticed a white space eventually overtaking my screen when hiding and showing the keyboard (seems to build up from the bottom).

@Andrew_Stacey odd on the line() issue, I’m guessing it’s something to do with the antialiasing in the line shader (similar to how rect() works).

The shader actually looks like below, where “Size” is a vec2 containing the length and stroke width of the line. It’s probably not behaving correctly when the stroke width is less than one.

varying highp vec2 vTexCoord;

uniform lowp vec4 StrokeColor;
uniform mediump vec2 Size;

void main()
{
    mediump vec2 nTexCoord = vec2( (vTexCoord.x + 1.0)*Size.x, (vTexCoord.y + 1.0)*Size.y ) * 0.5;
    
    highp float closestDist =  min(min(nTexCoord.x, Size.x - nTexCoord.x), min( nTexCoord.y, Size.y - nTexCoord.y ));
    
    mediump float aa_amount = max( min( Size.y - 0.5, 0.5 ), 0.0 );
    
    //Premult
    gl_FragColor = mix( vec4(0,0,0,0), StrokeColor, smoothstep(0.0, aa_amount, closestDist) );
}

```


@Jmv38 your `not` Lua example should not have changed in this version, we haven't changed Lua in any way. I'll have to look into your use of loadstring() in callbacks, if you can make a very simple example (< 50 lines) of loadstring not working that would be really helpful.

@JakAttak are you able to explain some more about how the pasteboard is being overwritten by Codea? You are not explicitly copying anything (either via the API or in the editor) in Codea?

@Luatee the keyboard one sounds odd, is this something you are able to make happen consistently? Thanks for that last bug report — for now I'll disable interaction while the project is starting up. But it's a good idea to change the behaviour of the X to cancel.