[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Concatenating module files...
- From: Petite Abeille <petite.abeille@...>
- Date: Sat, 21 Jun 2008 15:39:12 +0200
On Jun 21, 2008, at 10:53 AM, Duck wrote:
will I get identical results from "require(fruit)" as I used to get
from "require('banana'); require('mango')"?
Yes, you can have multiple modules in one file.
For example, a DB module [1] could contain a DBCursor module [2].
Requiring the main module ('DB'), will load both 'DB' and 'DBCursor'.
You can further require any sub modules -once you have loaded the main
one- to get a direct handle on each one of them, e.g.:
local DB = require( 'DB' )
local DBCursor = require( 'DBCursor' )
Cheers,
--
PA.
http://alt.textdrive.com/nanoki/
[1] http://dev.alt.textdrive.com/browser/HTTP/DB.lua#L24
[2] http://dev.alt.textdrive.com/browser/HTTP/DB.lua#L106