[JW Lua] Embed a JSON interpreter (cjson? dkjson?)

Robert Patterson robert at robertgpatterson.com
Thu Mar 23 04:25:05 CET 2023


There are two main reasons for CJSON in particular. One leads to the other:

1. CJSON is a pure C implementation, which means it is more than an order
of magnitude faster than dkjson
<https://kyne.com.au/~mark/software/lua-json-performance.html>.
2. Once we are talking about a C implementation, the dependencies start to
magnify. I embedded Luasocket and Luaosutils for the same reason. Embedding
means there is no extra cruft outside your script, and the same script is
usable on either platform.

I see JSON as potentially becoming more important to Finale Lua since I
have added https post to luaosutils. (It's already available in the
experimental version of RGP Lua I released, called internet.post.) If we
start integrating Finale with web services, which is a capability I have in
mind, JSON is likely to be a critical component of it.

BTW: I desperately wanted to use Luasocket for http, but for https it
requires LuaSec, and LuaSec has exploding dependencies. By contrast,
Luaosutils is lightweight and uses os-level services on Mac and Win to
send/receive data.


On Wed, Mar 22, 2023 at 7:28 PM Aaron Sherber <aaron at sherber.com> wrote:

> What would be the advantages of embedding it with Lua as opposed to the
> current method of requiring it (from src/lunajson) when it's needed?
>
> Aaron.
>
>
>
>
>
>
> On Wed, Mar 22, 2023 at 8:05 PM Robert Patterson <
> robert at robertgpatterson.com> wrote:
>
>> I just discovered that the Exasol database engine has an embedded Lua
>> interpreter similar to ours. I found a series of blog posts about their
>> efforts to upgrade from Lua 5.1 to Lua 5.4 (written last November.)
>>
>> Like us, they embed LuaSocket. Another thing they do is embed cjson. Is
>> that something we should think about doing for our embedded Lua? I already
>> know of three Finale Lua scripts that use a json formatter, and there will
>> probably be more.
>>
>> Robert
>>
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20230322/15ae6fe8/attachment-0001.html>


More information about the JWLua mailing list