Lua does not dictate things like this, but in the specific case of
modules it "recomends" its external behavior. From PiL2, chapter 15:
Usually, Lua does not set policies. Instead, Lua provides mechanisms
that are powerful enough for groups of developers to implement the
policies that best suit them. However, this approach does not work
well for modules. One of the main goals of a module system is to
allow different groups to share code. The lack of a common policy
impedes this sharing.
Starting in version 5.1, Lua defines a set of policies for modules
and packages (a package being a collection of modules).
It goes on to define these policies:
From the user point of view, a module is a library that can be loaded
through require and that defines one single global name containing
a table. Everything that the module exports, such as functions and
constants, it defines inside this table, which works as a namespace.
A well-behaved module also arranges for require to return this table.
But you are right that Lua does dictate anything about how to implement
this "recommended" behavior (calling 'module', using _ENV, etc.). That
is, there is a "standard contract", but not a standard way to implement
this standard contract. (And modules are free not to follow the
standard contract.)
-- Roberto