Closed jdonaldson closed 4 years ago
Thanks for reaching out! I unfortunately don't know much about haxe, and you're right in that I don't really want to maintain any haxe-specific code. You are welcome to fork the repo and create a haxe/lua version! It seems like it would be the cleanest approach. You could add a length operator and then try to make arrays start from 0. You could potentially also create a lua shim that sets up the metatables and stuff after parsing. The arrays starting at 0 might be a little tricky
However, it seems like a lot of Haxe users could get some benefit from the simdjson parser, so if you wrote the extension at the haxe level (assuming that's possible, again, I don't know much about haxe) that could be quite beneficial!
Thanks, this is good to know. I’ll fork this to something haxe-specific for now. However, I’ll keep tabs on your original version and share any significant updates/improvements with you.
I was intrigued by the simdjson library, and happy to see that you wrote a Lua wrapper for it.
I'm targetting lua using a transpiler (Haxe). Haxe has first class arrays, and they're different than Lua tables in these ways:
They have a
length
field, that is updated through metatable methods on the table.I'm wondering how best I could adapt your library here for that behavior. I've made some small alterations here that work for Haxe, but will naturally not work for "vanilla" Lua.
I think the two approaches I see that could work are:
convert_element_to_table
: This is easy for specifying a starting index, and the metatable, but would need an additional operation to set the length.parseHaxe
) : This would be way easier to specify, but perhaps you don't want to maintain that method.convert_element_to_table
that manages all the configuration via callbacks. (E.g. sax-like parsing options like "start_array", "end_array", etc.)In any event, thanks for the library. I know it's a work in progress, but it's covering some initial goals I had in mind.