lua-users home
lua-l archive

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


On Fri, Jul 6, 2012 at 5:17 AM,  <[email protected]> wrote:
> sourcing the code into a main file like done with unix shell scripts?
> Are there other ways?

Absolutely, and they work better than simply 'sourcing' the code (as
the C preprocessor does as well).

The function you need to understand is require()

http://www.luafaq.org/#T1.19

The short answer: require() is like dofile(), in that the source is
separately compiled, but it looks up the source on the _module path_.

steve d.