Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.
This repository was archived by the owner on Sep 12, 2025. It is now read-only.

No documentation on how to use LuaRocks with rlua #290

Open

Description

@Lilith-In-Starlight

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?

Activity

  1. jugglerchris commented on Jan 5, 2024

    @jugglerchris
    Collaborator

    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.

  2. Lilith-In-Starlight commented on Jan 5, 2024

    @Lilith-In-Starlight
    Author

    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?

  3. changed the title [-]How can I make HTTP requests with rlua?[/-] [+]No documentation on how to use LuaRocks with rlua[/+] on Jan 5, 2024
  4. jugglerchris commented on Jan 7, 2024

    @jugglerchris
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions