lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2015-06-09 1:44 GMT+02:00 Simon Cozens <simon@simon-cozens.org>:
> On 08/06/2015 21:47, Dirk Laurie wrote:
>> 2. Rework bit32-compat.lua to detect which Lua _VERSION is being
>> used and provide a module that equips Lua 5.3 with bit32. This has
>> the advantage that I might need it anyway sooner or later for other
>> 5.2 programs but the disadvantage that the dependence on Lua 5.2
>> with 5.1 compatibility turned on may rear its head elsewhere too.
>
> And Paul Kulchenko appears to have just done this, in a pull request
> merged just now.

Great! Sile 0.9.2 can typeset simple.sil under Lua 5.3 without recompiling
if one copies over lua-libraries/bit32-compat.lua and core/utilities.lua.

The new version contains the code

    lib = false
      or (pcall(require, "bit") and require("bit"))
      or (pcall(require, "bit32") and require("bit32"))

Is there a subtle reason for the construction
     (pcall(require, "bit") and require("bit"))
rather than just
     pcall(require, "bit")
?