[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.2 and 5.1
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 10 Apr 2013 12:07:05 +0200
2013/4/10 steve donovan <steve.j.donovan@gmail.com>:
> Remembering to return the module is one of those things
> a person forgets, especially if they're used to module.
>
> function newmod(name)
> local mod = {}
> package.loaded[name] = mod
> return mod
> end
>
> local M = newmod(...)
> ...
> And then voila, no need to return M at the end!
-1.
Forgetting to return the module table is like forgetting to take your
cash out of the automatic teller machine: it's a waste, but you'll
discover pretty soon you haven't got it.
Messing around with package.loaded qualifies as obfuscated code.
- References:
- 5.2 and 5.1, David Burgess
- Re: 5.2 and 5.1, Matthew Wild
- Re: 5.2 and 5.1, Luiz Henrique de Figueiredo
- Re: 5.2 and 5.1, Miles Bader
- Re: 5.2 and 5.1, David Burgess
- Re: 5.2 and 5.1, Coda Highland
- Re: 5.2 and 5.1, steve donovan
- Re: 5.2 and 5.1, Joshua Jensen
- Re: 5.2 and 5.1, steve donovan
- Re: 5.2 and 5.1, Dirk Laurie
- Re: 5.2 and 5.1, steve donovan
- Re: 5.2 and 5.1, Dirk Laurie
- Re: 5.2 and 5.1, Andrew Starks
- Re: 5.2 and 5.1, steve donovan
- Re: 5.2 and 5.1, Dirk Laurie
- Re: 5.2 and 5.1, steve donovan
- Re: 5.2 and 5.1, Dirk Laurie
- Re: 5.2 and 5.1, steve donovan