On Tue, Jan 17, 2012 at 9:09 AM, Enrique Garcia Cota
<kikito@gmail.com> wrote:
You now return only a function, if you return a module table, then you can
use the metatable of the module table to create an 'call' metamethod that
would behave the same as the function you return now, but also use the
module way of accessing.
Right! I forgot about functors. I don't think I'll include a "newVersion" method though; but I'll transform version into a callable table with a _VERSION field. I'll work on it this evening.
_VERSION uses a format (most common) of name followed by version; eg. 'Lua
5.2', so any utility function should first grab the last part (after the
last space) of the string and then perform comparisons.
Hmm. I don't think semver is the right place to do that. It's supposed to be an implementation of
semver.org. Adding that functionality would make it lose its "focus".
I think that functionality should go in a different lib; "luaversion" or "luamoduleversion" or similar.
Regards!