lua-users home
lua-l archive

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


Axel Kittenberger <axkibe@gmail.com> wrote:
>
> I dunno, why can node.js do  it right on modules so simply,
> albeit in general Lua would be a much saner language than javascript.

There's not much difference between the require functions in Lua and Node.

The search paths work differently.

Node has a magic "exports" object whereas Lua lets the programmer choose
the name of the exported table which must be explicitly returned.

Node and Lua-5.1 suppress recursive requires. Lua-5.2 does not.

The differences in scoping seem to have more to do with differences
between JavaScript and Lua rather than anything to do with modules per se.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
Sole: Northwesterly 4 or 5, occasionally 6 in east. Rough or very rough. Rain
then showers. Good occasionally moderate.