Standalone FFI library for calling C functions from Lua, compatible with LuaJIT's FFI interface.
luaffi is a standalone Foreign Function Interface (FFI) library for Lua that enables calling C functions and manipulating C data types directly from Lua scripts. It solves the problem of C/Lua interoperability by providing an interface compatible with LuaJIT's FFI, allowing developers to work with C libraries without needing the full LuaJIT environment.
Lua developers who need to interface with C libraries, particularly those working on cross-platform applications, embedded systems, or projects requiring C interoperability without LuaJIT.
Developers choose luaffi because it provides LuaJIT's powerful FFI interface as a standalone library compatible with standard Lua 5.1/5.2, offering cross-platform C interoperability without the overhead of full LuaJIT while maintaining familiar syntax and functionality.
Standalone FFI library for calling C functions from lua. Compatible with the luajit FFI interface.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works on Windows (x86/x64), Linux (x86/x64), Windows CE ARM, and macOS (x86/x64), offering broad compatibility for multi-platform development as stated in the README.
Designed to be interface compatible with LuaJIT's FFI, allowing developers to migrate existing FFI code to standard Lua with minimal changes, per the project's philosophy.
Runs with both Lua 5.1 and Lua 5.2, providing flexibility for different Lua environments, as highlighted in the README's platform support section.
Uses dynasm for just-in-time compilation of C function calls, optimizing performance similar to LuaJIT, as explained in the 'How it works' section.
Casting follows C++ semantics, differing from LuaJIT, and pointer nil comparisons require using ffi.C.NULL instead of direct comparisons, as noted in the known issues.
Not all metamethods work with Lua 5.1 due to type lookup limitations, necessitating upgrades to Lua 5.2 or workarounds for certain operations, as mentioned in the known issues.
Currently only supports DLL builds, not static libraries, which can be restrictive for environments requiring static linking, as specified in the platforms section.
Lacks support for vectors, C++ reference types, and other features from the todo list, limiting use in complex C++ interoperability scenarios.