lua-users home
lua-l archive

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


On Thursday, February 11, 2016 at 11:08AM, Marc Balmer wrote:
> 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);

I do essentially the same thing, and I think it is (relatively) common.
I first got the idea from a blog post[1] and I wrote up how I do it in
C modules as well[2]. (My method is just a variant of yours.)

It would be nice if there were some general agreement about what fields to
include though. I currently use __AUTHOR, __VERSION, __LICENSE, and __URL.
It sounds as though there are already many versions of this idea, all with
slightly different fields.

[1]: http://kiki.to/blog/2014/03/31/rule-2-return-a-local-table/
[2]: http://ithaca.arpinum.org/2014/04/20/lua-c-modules.html
-- 
We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
    Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System