lua-users home
lua-l archive

Re: Is there a similar way to do if __name__ == '__main__' as in python ?

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


--- Rici Lake <lua@ricilake.net> wrote:
> Yes, that's one of the reasons I don't use module().
> 
> The actual code in my original message avoids
> hard-coding
> the module name with the line:
> 
> local myname = ...
> 
> at the beginning. That picks up the first argument
> supplied
> when the module chunk is called; if it is called by
> require(),
Ah, I thought module() is now the recommended way.
But anyway, out of curiosity, what would be the usage
scenario for not hardcode the module name ? As my
limited usage of require() is just to load another
file which is hardcoded in the file system anyway ?
 
____________________________________________________________________________________
Now that's room service! Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

AltStyle によって変換されたページ (->オリジナル) /