[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: question on modules (newbie)
- From: Romulo Bahiense <romulo@...>
- Date: Thu, 23 Feb 2006 09:57:27 -0300
A few notes:
- module is defined in Lua-5.1, or in Lua-5.0 using compat.lua
... using compat-5.1.lua . compat.lua found at lua/src/etc is to make
Lua5 be compatible with Lua4.
- module don't have to be called with the file's name, but it is very
advised to do so
... in Lua-5.1 you can write: module(...)
... in Lua-5.0 with compat-5.1 you can write: module(arg)
- module should be the first function to be called in the
file/script/chunk, or will you have unexpected behavior.
... See my other e-mail. My compat-5.1 can be broken (I changed it a bit
from the original distro), but if you call module after declaring a
function/global, then they will be put in globals and in the module's
new environment. with Lua-5.1 final, just the functions before the call
of module will be put in globals. I have to check my compat-5.1 to see
if I made some mistake, but the important thing is to be conscientious
about unexpected behaviors like this one when you use module after other
declaration. IIRC, this has been discussed some months ago in this
Sorry again for not being clear.