Lua

Modifying pidigits of Computer Language Benchmark Game for Lua 5.4.8

Problem #

pidigits need lgmp large number library

lgmp is not available for Lua 5.4.x

lgmp is only available in luarocks for up to Lua 5.3.6

pidigits.lua from CLBG site just use some kind of ‘bn’ library, but the library is not given.

in original code, ‘bn’ library is loaded with the following code:

local Lbn=require"bn"

which gives error:

lua: pidigits.lua:7: module 'bn' not found:
        no field package.preload['bn']
        no file '/usr/local/share/lua/5.4/bn.lua'
        no file '/usr/local/share/lua/5.4/bn/init.lua'
        no file '/usr/local/lib/lua/5.4/bn.lua'
        no file '/usr/local/lib/lua/5.4/bn/init.lua'
        no file './bn.lua'
        no file './bn/init.lua'
        no file '/usr/local/lib/lua/5.4/bn.so'
        no file '/usr/local/lib/lua/5.4/loadall.so'
        no file './bn.so'
stack traceback:
        [C]: in function 'require'
        pidigits.lua:7: in main chunk
        [C]: in ?

Reading from the CLBG site does not offer clue how to install this ‘bn’ library.