lua-users home
lua-l archive

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


It was thus said that the Great Marc Balmer once stated:
> We usually put some information strings into our modules, e.g.
> 
> 	lua_pushliteral(L, "_COPYRIGHT");
> 	lua_pushliteral(L, "Copyright (C) 2014 micro systems marc balmer");
> 	lua_settable(L, -3);
> 	lua_pushliteral(L, "_DESCRIPTION");
> 	lua_pushliteral(L, "EAN support functions");
> 	lua_settable(L, -3);
> 	lua_pushliteral(L, "_VERSION");
> 	lua_pushliteral(L, "ean 1.0.1");
> 	lua_settable(L, -3);
> 
> How do other module-writer handle such?  Do you put such information into
> modules?  Do you think it makes sense?  Is it of any use at all?  Is it
> common practice? (yes, I am considering removing it...)

  I went back and forth on that:

	commit 7ca1db21061a58def0182ddb7f25915083cf9cf1
	Author: Sean Conner <spc@conman.org>
	Date:   Thu Nov 15 19:59:09 2012 -0500
	
	    Removed unused fields.
	
	    I removed _VERSION, _DESCRIPTION, _LICENCE and _AUTHOR because, well ... on
	    second thought, it was silly.  And most of the Lua only modules didn't
	    have the fields anyway.
	
	commit 9990ff9083dca92f2c0e1f3c6df5df6beb5d9c35
	Author: Sean Conner <spc@conman.org>
	Date:   Tue Apr 30 21:36:41 2013 -0400
	
	    I'm back to using _VERSION.
	
	    Added it to strcore.
	
	commit 2f7b4addd68993850f97d05f4952efdc6616ce29
	Author: Sean Conner <spc@conman.org>
	Date:   Sat May 31 03:04:58 2014 -0400
	
	    Remove _VERSION from strcore.
	
	    _[A-Z] is reserved for Lua.  I have to remember that.

and as you can see, in the end, I removed them completely.  While _VERSION
is useful, I can't say I have actually *used* such checks in my own code,
mainly because the way I work I know I always have the proper version
installed.  The rest (like _AUTHOR) I see as a waste of space *unless* I'm
manipulating modules themselves and well ... I have LuaRocks for that.

  -spc