lua-users home
lua-l archive

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

>When you run test.lua with module written this way, the function report
>isn't printed.

The problem is that module.lua gives a parse error:

$ lua module.lua
error: cannot access a variable in outer scope;
  last token read: `modname' at line 7 in file `module.lua'

However, "import" loads module.lua using an empty environment, one that does
not even contain _ERRORMESSAGE, and so no message is reported.

The code you used for "import" was based on some code posted to the list
as an example. For production, you have to be careful when you use "globals",
because almost everything "vanishes".