lune-org / lune

A standalone Luau runtime
https://lune-org.github.io/docs
Mozilla Public License 2.0
295 stars 67 forks source link

Support for Foreign Function Interface (FFI) #157

Open SnorlaxAssist opened 4 months ago

SnorlaxAssist commented 4 months ago

A more powerful way to access libraries to make lune more extensible. Similar to node-ffi.

  1. Allow Lune to directly call functions defined in libraries. This will enable more complex and high-performance features.
  2. Security should be considered heavily on this solely because execution could be unknown, something like prompting the end user once to allow libraries being used in running scripts via lune run.
  3. Some Use Cases
    • High-performance computing tasks within Lune.
    • Accessing system-level or third-party services.
    • Communicating with the GPU in Lune.
    • And more.
CompeyDev commented 4 months ago

This would be great to have as an alternative, considering the ETA for native modules is currently unknown. +1.

nickk431 commented 1 week ago

Very interested in this. Any updates?

CompeyDev commented 1 week ago

None. We're dependent on mlua upstream to implement native module supports for all platforms, and hopefully make it safe.

I've tried implementing them by hand, but the problem ends up being we have to practically create #[repr(C)] wrappers around all mlua structs.