Codea 2.3 Beta

@Andymac3D JSON libs dont work any more? Do you mean the great tool to post gists doesn t work any more?

@Jmv38 - I would certainly test your old code that use any legacy JSON libs. Certainly dkjson.lua doesnt work for me (which is popular one) and a couple of others i’ve tried.

Would be useful if others can investigate this further as well (but probably outside the scope of this thread) I suspect it does have some implications for legacy code I guess.

@andymac3D Juce made a fantastic gist uploader that uses DKjson. http://codea.io/talk/discussion/comment/48060/#Comment_48060.
I guess now i doesnt work any more if DKjson is broken… So much rework to do :((

@Jmv38 I’d certainly try it before you slash your wrists :wink:

p.s. It may just need a bit of tinkering to update the library - but theres an awful lot of involved string parsing it appears to do, its just finding the time. However, updating other peoples code is often a pain in the arse :-/

Next build will have fixed sockets library. Thanks @SkyTheCoder for pointing out the missing functions.

I will look at porting the dkjson library and perhaps integrating it.

Just a note that the latest dkjson library does work fine with Lua 5.3. I will have it built-in in the next build.

@Simeon, this is great news about dkjson being built in, thanks.

Thanks @Simeon, great news! ( It appears the site I’d been using to pull data off had some badly formed JSON feeds for some reason - apologies to @Jmv38! :slight_smile:

Not sure if it’s a 2.3 thing or it’s always been there - but how do you access code tabs using Aircode when they’re off the right of the browser window. As soon as the tab list gets bigger than the desktop resolution you don’t seem to be able to access them at all.

Here’s the plan for the next build:


#Private Libraries
You can use these in your projects but they will not be documented. They will be used to build other Codea features:

These are not imported into the global namespace by default, to use them you’ll need to import them using require, e.g.

-- Import lpeg for current tab
local lpeg = require("lpeg")

-- Import socket for all tabs
socket = require("socket")

(Side note: LPeg is an incredible pattern matching language implemented as a native C library. The dkjson parser claims to make use of it for a significant speedup, so it now exists in Codea to implement dkjson optimally.)


#Public Libraries
These are in the global namespace by default.

  • dkjson available as json

You should just be able to use json.decode and json.encode from anywhere.

2.3 (38) should fix the missing functions in socket, as well as saveText. It also includes the libraries mentioned above.

Initial tests on my app on 2.3 (38) appear ok.
I’ll replace my internal JSON library with the json one and let you know how that works.

these libs look really cool!

@Simeon, this all sound great. I’ve tested saveText and it is working properly, great. loadstring is a pretty huge deprecation, I’m wondering if it might be a good idea to keep it as a compatibility function that just calls load, like http.get

@JakAttak loadstring is still there and just calls load. But it’s not highlighted or auto completed to discourage use.

@Simeon, ah I spoke too soon there. My issue wasn’t load string, it was that readText doesn’t work with files created by saveText.

Try this:

    saveText("Project:weird", "interesting")
    print(readText("Project:weird"))

Thanks @JakAttak, will fix.

A strange behavior with multi-texture shader when rects not sized to original image size nor power of 2. Colored noise is drawn in place of image. Example code can be found here : https://www.dropbox.com/s/7k5f7i0y1xgl9rw/multi_tex_bug.lua?dl=0

Btw, I don’t know if it’s possible and there is more important stuff, but, it would be great to have mesh ‘drawArray modes’.

something like that:

mesh:draw([TRIANGLES|TRIANGLES_STRIP|LINE|POINT...], [start, count])

@toffer strange! Was that happening in a previous version?

@toffer it appears to be lack of precision on the iPad GPU

Modifying to check the texture id within an epsilon corrects the rendering.

void main()
{
    //Sample the texture at the interpolated coordinate
    highp vec4 col;
    if (vTex > 0.99 && vTex < 1.01) { col = texture2D( texture1, vTexCoord ) * vColor; }
    if (vTex > 1.99 && vTex < 2.01) { col = texture2D( texture2, vTexCoord ) * vColor; }
    //Set the output color to the texture color
    gl_FragColor = col;
}