Tieske / uuid

A pure Lua uuid generator (modified from a Rackspace module)

Home Page:http://tieske.github.io/uuid/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lua version check fails

mokaddem opened this issue · comments

Hello,
Thanks a lot for this useful project!

I'm having an issue with the code line below

uuid/src/uuid.lua

Lines 178 to 184 in 190b336

if lua_version < 5.2 then
-- 5.1 uses (incorrect) signed int
math.randomseed(seed - 2^(bitsize-1))
else
-- 5.2 uses (correct) unsigned int
math.randomseed(seed)
end

For my Lua version 5.2.4 (ubuntu), _VERSION seems not to be assigned and thus is set to nil. I had to modify the code and manually assign it to 5.2 to prevent it to fail.

The good news is, I don't have this issue with other versions.

Now, would it be sane to do the following right before line 178?

if lua_version == nil then
    lua_version = 5.2
end

Or maybe there is another way to circumvent this issue?
Thanks a lot for your time!

just tried:

docker run -it --rm ubuntu /bin/bash
apt update
apt install -y lua5.2
lua -e "print(_G._VERSION)"

Gives me

Lua 5.2

Could the problem be with your installation?

Mmh. Indeed I cannot reproduce it either. It's most probably an installation issue.
On my laptop, it's working fine. But on another machine, it's still failing after installing Lua 5.3 from Ubuntu's official PPA.
Thanks for your help anyway!