range fails with lua 5.4
- Dominant language
- Lua
- Stars
- 11
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
```
local version = require('version')
local r = version.range("1.30", "1.45")
print(r:matches("1.32"))
-- Lua 5.3
true
-- Lua 5.4
./version.lua:166: attempt to compare two table values
stack traceback:
./version.lua:166: in method 'matches'
script.lua:4: in main chunk
[C]: in ?
```
I think this is linked to this sentence (Lua 5.4 reference manual) : "The use of the __lt metamethod to emulate __le has been removed. When needed, this metamethod must be explicitly defined. "
It works with the following ugly hack:
```
local version = require('version')
getmetatable(version("1.0")).__le = function(a, b)
return a == b or a < b
end
local r = version.range("1.30", "1.45")
print(r:matches("1.32"))
````
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Lua 5.4 reproduction in the issue and inspect version.lua around line 166, where range:matches fails while comparing version values. Compare the metamethod behavior with Lua 5.3 and verify the reported example works without the workaround. Done means the range check returns true on Lua 5.4 while preserving the Lua 5.3 behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100