On 23:41 Wed 04 Jul 2012, Tang Daogang wrote:
> I find that
>
> local xxx = require 'foo.bar'
>
> won't find foo/bar.lua, but find foo.bar.lua?
Yes, we use the similar pathing to node.js.
> But write
> local xxx = require 'foo/bar'
> is ok.
>
> Why do this design?
The primary reason is that it makes it clear all you are doing is
requiring files. Also it it makes relative and path based imports look
the same.
> require 'foo.bar' package -- subpackage -- module, is it not pretty?
>
> this decision with make most lua library unusable....
That is OK though. Most lua library modules won't play nice as-is on
luvit anyways. They need to be ported to the API that is available on
luvit to be useful and need to be modified to not pollute the globabl
scope in many cases.
luvit uses lua as an implementation language just like node uses
javascript as an implementation language. But, we don't pretend like
everything that runs on the regular lua interpreter will run on luvit.
Just as node doesn't try to emulate all the peculiarities of client side
code.
I hope this helps.
In the spirit of all of the silly acronyms in the node community:
"luvit uses lua but implements require differently" lulbird
Brandon