lunarmodules / Penlight

A set of pure Lua libraries focusing on input data handling (such as reading configuration files), functional programming (such as map, reduce, placeholder expressions,etc), and OS path management. Much of the functionality is inspired by the Python standard libraries.
https://lunarmodules.github.io/Penlight/
MIT License
1.93k stars 241 forks source link

Incorrect integer detection #455

Closed sadSader closed 1 year ago

sadSader commented 1 year ago
--Lua5.4
pr = require("pl.pretty") 
pr.write(1e100)
--Error:
-- /usr/share/lua/5.4/pl/pretty.lua:33: bad argument #1 
-- to 'format' (number has no integer representation)

The error is in incorrect check for _VERSION: 5.4 also has integer type. https://github.com/lunarmodules/Penlight/blob/3bf03267b2571ba3cfa676a10528dd7b9a0db404/lua/pl/pretty.lua#L32 Similar problem here: https://github.com/lunarmodules/Penlight/blob/3bf03267b2571ba3cfa676a10528dd7b9a0db404/lua/pl/pretty.lua#L36