lua-users home
lua-l archive

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


	Hi Chris,

Wow, that seems like a lot of work. Has anyone done a library to make any of this simpler?
	Some time ago we also start the development of some libraries
and needed this kind of stuff.  We implemented a small library with an
API similar to luaL*.  For example:

function tryconnection (dbkey, dbname, dbuser, dbpass, driver)
    check.str (dbkey, 1, "db.tryconnection")
    check.str (dbname, 2, "db.tryconnection")
    check.optstr (dbuser, 3, "db.tryconnection")
    check.optstr (dbpass, 4, "db.tryconnection")
    check.optstr (driver, 5, "db.tryconnection")
...

	(The third argument to check.* functions is optional)
	We implemented a module called check which contains the
functions: str, udata, table, optstr and opttable.  We're improving
it on demand :-)
	However, some tests showed us that we had a 20% lost in
performance, so we developed a simple tool to extract all the calls
to module check and the `require"check"' line also.  The module is in
fact used only in development environment; in production it is removed.
	I was planning to put it in LuaForge if someone wants to
take a look.  It has no HTML documentation, since LuaDoc 3 was not
introduced yet.

	Tomas