lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

Asko Kauppi wrote:
> Is there a reason why Lua engine's version is not clearly (for the 
> machine) available in a constant s.a.
> 
> LUA_VER= 5.104

Make this 5.0100 = 5.01.00. Work versions are comparable to CVS versions
in other software projects and usually get either the next or the previous
release number (using the next release makes more sense IMHO).

> This would be useful for scripts that intend to be version independent. 
>  Now, they need to parse '_VERSION' ("Lua 5.1 (work4)") and there's no 
> guarantee the format of that will remain as is?

I second this. Having a printable _VERSION is nice (but rarely used).
Having a number is much more useful. Since it has been stated quite
explicitly that the API may change across Lua versions, scripts need
a way to account for the differences.

I'd like to have such a number both for the Lua side (a global number)
and for the C side (a #define in lua.h).

Actually I suggested the latter as part of my cumulative loadlib patch:

> Add a version define that allows for stuff like:
> #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 0x050100L
> Note that prerelease ("work") versions need to be tagged with the release
> version they are destined for ("5.1.0" -> 0x050100L).
> NB: It needs to be a long constant to account for 16 bit systems.

> --- lua-5.1-work3/include/lua.h
> +#define LUA_VERSION_NUM        0x050100L

Alas, this change was not merged into 5.1w4.

I think an issue tracker would help keeping track which changes were merged,
were refused, became obsolete or whatever ...

Bye,
     Mike