Target: lua
Closed this issue ยท 10 comments
Use the Lua ffi
module.
Do you mean embed lua 5.x into hl as lua.hdll?
sound's great!
@sonygod No, although that should also be possible. This issue is about compiling Haxe into a Lua (LuaJIT) script and using native libraries from Lua using the FFI module.
@sonygod
With ammer you can write the required FFI to link a Lua VM in HL, just like this one: https://github.com/kevinresol/hxvm-lua
@kevinresol ,sorry ,I still don't know how to do this. hxvm-lua support hl?
@sonygod No, hxvm-lua
supports C++ and JS (browser and Node.js). With ammer
it should/will be possible to write a Lua wrapper that will work on HashLink as well. I might have a look at implementing that later.
I haven't seen it thrown out there yet but..
Why not also node.js and python?
@piboistudios They are planned, there is just no issue open for them yet.
Lua support landed, just need to put it in the CI. No callback support, but I want to see how other targets will fare first. It might not be realistic to have callbacks in general, because a native library really needs a C function to call, whereas closures (i.e. anonymous functions on most of Haxe targets) carry around some additional state.
I think callbacks are important but not dire (i.e. more platforms/stability/CI is more important atm).
But one use case is the windows synchapi. Offers IPC events and blocking critical sections which are very nice and robust low level tools for async synchronization. (I'll use HL for now anyhow, but I plan on writing that extension soon, and it'll be nice if other targets can use it as ammer grows; if you foresee working on it for that long ;) )
@sonygod No,
hxvm-lua
supports C++ and JS (browser and Node.js). Withammer
it should/will be possible to write a Lua wrapper that will work on HashLink as well. I might have a look at implementing that later.
Any intention of making this ๐? Trying to get it done myself in a nice way with git submodules & automating it, but kind of stuck.. Sorry If I misunderstood what you meant here.