[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require vs dofile and how to organise many functions
- From: Petite Abeille <petite_abeille@...>
- Date: Tue, 21 Jul 2009 18:38:53 +0200
On Jul 21, 2009, at 10:05 AM, startx wrote:
i know that require has the advantage to load both pure lua and C
extentions, but is there any other technical difference i am not aware
of? (memory management etc)
As mentioned by Steve, require will keep track of what has already
been loaded.
Take a look at Kepler's 'compat' to get a sense on how to simulate it:
http://luaforge.net/plugins/scmcvs/cvsweb.php/compat/src/?cvsroot=compat
http://luaforge.net/plugins/scmcvs/cvsweb.php/~checkout~/compat/src/
compat-5.1.lua?rev=1.22;content-type=text%2Fplain;cvsroot=compat
or is this just a decision of coding style?
Style and pragmatism. After all, Lua doesn't include many batteries.
Doesn't hurt to use the few which are provided.
For a contrarian view on module, check David Manura rant:
http://lua-users.org/wiki/LuaModuleFunctionCritiqued
I, for one, welcome our module overlord :)
would this be considered an inappropriate coding style?
Yes, quite bad taste indeed :P
On the other hand, "des goûts et des couleurs on ne discute pas"...
i haven't seen this in other projects so far ....
LuaSocket uses such constructs. Always found that sort of packaging
very cumbersome. Of course, YMMV.
Cheers,
--
PA.
http://alt.textdrive.com/nanoki/