rlua
rlua copied to clipboard
No documentation on how to use LuaRocks with rlua
EDIT: Previously titled "How to make HTTP requests with rlua?"
(Can't really find a more appropriate place to ask this question, if there's a better place, please point me to it!)
I'm trying out different crates that add scripting support, because I want to make a plugin system for my program that can add features without me having to expose them from the program (I want to keep the program minimal). The rlua crate is one of the ones I'm considering, but it seems like it lacks modules like http or socket in order to make requests.
This is one of the examples I could come up with of features that I don't see the point in adding to my program and then exposing for plugins to use if I'm never going to use that feature in the un-modded program.
Is there something I'm missing or is this outright impossible?
Hi, I guess the discussions might be a slightly better place than issues, but this is fine (and see below).
rlua wraps a stock Lua interpreter (https://www.lua.org/), so any Lua libraries should be available (for example https://luarocks.org/, which includes lua-http).
What's missing is documentation on using (for example) LuaRocks with rlua. I think it should be straightforward (especially when using one of the system-lua options) - I will treat this issue as a documentation bug.
Note that rlua by default disables loading non-pure-Lua libraries unless you call Lua::unsafe_new_with_flags and don't include the LOAD_WRAPPERS and REMOVE_LOADLIB flags.
Oh my bad! I totally forgot github discussions were even a thing. I'll rename the issue more appropriately now that it's gonna be regarded as a documentation bug.
I'm using the builtin 5.4 lua option, because I don't want to make people have to install lua just to get the program to work. Since currently there is no documentation on it, how would I use LuaRocks with rlua?
I've done some investigation and experimentation, and have a proof of concept using LuaRocks (and some notes) from an rlua executable: https://github.com/jugglerchris/rlua_luarocks
The example behaves enough like a lua binary to install its own copy of LuaRocks and use that (using builtin-lua54). That's not the only way - it would be possible to use a stock Lua install (with matching version) for LuaRocks, and point to the installed libraries from the application using rlua.