Tieske / uuid

A pure Lua uuid generator (modified from a Rackspace module)
http://tieske.github.io/uuid/
137 stars 50 forks source link

Lua version check fails #14

Closed mokaddem closed 2 years ago

mokaddem commented 2 years ago

Hello, Thanks a lot for this useful project!

I'm having an issue with the code line below https://github.com/Tieske/uuid/blob/190b336601710efa13ce0f9c85584bc4eef425d0/src/uuid.lua#L178-L184

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!

Tieske commented 2 years ago

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?

mokaddem commented 2 years ago

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!