lua-users home
lua-l archive

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


hello.

i recently started to use a lot of lua and really like the
language. however, i am currently working on a project where i
use lua as a kind of glue/wrapper language to create an library 
around various functions around video encoding, and i came across
some questions how to organise and use these functions.

1) so my "library" consists of about 50-60 functions, and my first
question is if it is preferable to write that simply as a list of
functions in a specific namespace such as


function myproject.do_something()
function myproject.do_this()

etc

and then make those function available via

dofile 'mylib.lua'

or if i should use the pure lua module format and load make it avalable
with

require 'mylib'

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) or is this just a decision of coding style?

2) my second question is about the use of namespaces: as i have quite
a lot of functions, i would like to use a "subnamespace" to group the
functions to something like:
 
myproject.core.do_something()
myproject.core.do_this()

myproject.media.get_videolenght()
myproject.media.get_metatags()

etc ...

would this be considered an inappropriate coding style? i haven't seen
this in other projects so far ....

thx for any help,

startx