[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: A Look at the Design of Lua
- From: Pierre Chapuis <catwell@...>
- Date: Fri, 02 Nov 2018 16:22:29 +0100
On Wed, Oct 31, 2018, at 15:37, Hisham wrote:
> I'm slightly annoyed that basic Lua module examples often display
> messy naming practices. Here, the module is written named as "M",
> stored in a file called "mymodule" and required into a variable "vec".
For what it's worth, I like the "M" part. It's even part of the internal style
guide at my company. It makes modules easier to rename for one thing.
Also works when you overload existing libraries (e.g. you define
`mycompany.json` that depends on luajson...).
The file being named "mymodule" is a bit weird outside of an example
but like Dirk said we frequently do require something called "xxx.foo"
as "foo". That's not unique to Lua either, for instance Python has the
`import xxx as yyy` syntax to do the same thing.
I also agree with Dirk that the main issue is the name of the LuaRocks
package, not the name of the file. Often with large modules the file
name will be `init.lua` anyway.