Skip to content

Make bit32 dependency conditional (for lua 5.5) #245

Open

Description

@scossu

Following up wahern/cqueues#265), http can now use a Lua 5.5 compatible version of cqueues.

The http rock is still pinned behind 5.5 though,because of the bit32 requirement which is not available (and supposedly, not needed for lua>5.1) for lua5.5.

Some other projects, such as luaposix, use this trick:

do
   -- We only want to install a bit32 module for Lua 5.1.
   local _ENV={package=nil, dependencies=dependencies}
   if package then
      dependencies[#dependencies + 1] = 'bit32'
   end
end

I have no experience with Lua 5.1 but I assume that it's relying on some boolean casting of nil that changed after that version.

Can a similar method be used in the http rockspec?

Activity

  1. daurnimator commented on Oct 6, 2026

    @daurnimator
    Owner

    I tried to keep the rockspecs purely declarative.

    "bit32"; -- Only if lua == 5.1

    @hishamhm should I add a condition to the rockspec? Or should I publish different rockspecs for each lua version like cqueues does?

  2. hishamhm commented on Oct 6, 2026

    @hishamhm

    Any way I could think up to make this nicer would be an incompatble change in LuaRocks (though I'm more keen to the idea of a rockspec v4 format now). Perhaps @siffiejoe could release a bit32 package update that's just a no-op in Lua 5.5? (As is already the case for Lua 5.2-to-5.4).

    In the meantime you could luarocks upload your own fork of the bit32 rockspec with Lua 5.5 support and then depend on "daurnimator/bit32" — rock namespaces have been supported for a long time now (Luarocks 3.0?), they're just not used a lot.

  3. scossu commented on Oct 6, 2026

    @scossu
    Author

    Yes, I already have my own rockspec that removes the bit32 dependency altogether (my project is only compatible with 5.4 and above), but relying on a root manifest would be nicer.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions