extension-fbinstant
extension-fbinstant copied to clipboard
Accept Lua tables as arguments and serialize to json in c land
Currently the communication from Lua to JS via C requires complex data structures (Lua tables) to be serialized to JSON in Lua before passed on as a string to the extension and deserialized again in Javascript. The same process but in reverse goes for complex responses from Javascript back to Lua.
The preferred solution is to pass Lua tables to C and let the C code serialize to JSON. Currently there's no support for serializing a Lua table to JSON from C.
Task: Evaluation of JSON parsers in C. Integrate with extension.
- https://github.com/zserge/jsmn
- https://github.com/nlohmann/json
- https://github.com/kazuho/picojson
- And possibly others
Perhaps Lua table to JSON and back again should be part of the DMSDK?
We use jsmn internally for json.encode(). This, together with a json.decode() from a yet to be decided lib, should be externalised and made available as part of DMSDK.