rust-lua53
rust-lua53 copied to clipboard
Using third party Lua libraries
Hi, It would be useful to include some third-party Lua libraries like LuaFilesystem into an application using rust-lua53. Since it builds its own copy of Lua, is there a good way to do this? Thanks, Chris
You can either load the lfs C library from Lua using require, or you can wrap lfs yourself if you need to make calls to it directly from Rust.
@jugglerchris I'm interested in addressing this issue. Could you describe the troubles you ran into in more detail?
@SpaceManiac My concern was about compiling Lua libraries against the same Lua headers as the rust-lua53 was using. But I don't think it's that important - the Lua ABI is fairly well set, so separately-compiled modules should be fine. This was thinking ahead - so far I haven't needed to install third party Lua modules in my application.
Alright, sounds fine. Just as a note for the future, if this does become an issue, the build script can export an environment variable which is accessible to the build scripts of dependencies, and this could be used to pass along the Lua include directory.
That sounds like a useful technique, thanks! I'm not sure how to use it here, as rust-lua53 and other packages would both be dependencies of a larger project, rather than rust-lua53 depending on it.
Other way around: lua-sys exports DEP_LUA_INCLUDE, external-lua-lib-sys depends on lua-sys and adds that value to the include path.
EDIT: whoops. Know not to respond to emails using that client anymore...