lune-org / lune

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

Support for Foreign Function Interface (FFI) #157

Open SnorlaxAssist opened 9 months ago

SnorlaxAssist commented 9 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 9 months ago

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

crowsyndrome commented 5 months ago

Very interested in this. Any updates?

CompeyDev commented 5 months 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.

amol234545 commented 2 months ago

There is a draft pr for FFI: #243