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

fix(pretty): update integer check for Lua5.4 #456

Closed sadSader closed 1 year ago

sadSader commented 1 year ago

Fix #455

sadSader commented 1 year ago

I added check for integer ranges in 5.1/5.2.

Tieske commented 1 year ago

The AppVeyor tests (Windows) fail. This stuff is hard to get right, since it is platform specific, and probably LuaJIT also deals with these edge cases slightly different.

The safest way is probably to try and dynamically test the number ranges supported by the underlying Lua engine.

sadSader commented 1 year ago

The AppVeyor tests (Windows) fail. This stuff is hard to get right, since it is platform specific, and probably LuaJIT also deals with these edge cases slightly different.

The safest way is probably to try and dynamically test the number ranges supported by the underlying Lua engine.

Unfortunatly string.format code is quite platform and version specific. I'll think how to fix it on next week

sadSader commented 1 year ago

Made runtime calculating min/max integers. Disabled tests with large integers for Lua versions without integer support. string.format("%d") can't reliably format integers on such versions.

I don't see any way to portably format integers without manualy rewriting string.format for integers

Tieske commented 1 year ago

thx!