lua-users home
lua-l archive

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


2011/9/7 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>> Are there any conventional ways to have a library return its version?
>> I'm thinking of something simple I can use in a build system like
>>
>> lua -l foo -e 'print (foo.version)'
>>
>> which simultaneously tests that the library can be found and gets its version.
>
> Mos of my libraries support this.

It is not really a standard, for example, lpeg.version is a function
which returns a string

lua -l lpeg -e 'print(lpeg.version())'

and my modules use foo._VERSION which is a string containing only a
dotted version number (other informations are available with
_DESCRIPTION and _COPYRIGHT)

lua -e 'print(require[[foo]]._VERSION)'

>
>> Something standard about the format of the version would also be nice.
>
> This is harder to support or standardize but my libraries use this format:
>
> ascii85 library for Lua 5.1 / Mar 2010
> bc library for Lua 5.1 / Apr 2010 / based on GNU bc-1.06
> md5 library for Lua 5.1 / Jun 2011 / using OpenSSL 0.9.8
> random library for Lua 5.1 / Nov 2010 / using Mersenne Twister
>
>