[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 11:01:20 +0200
2013/4/10 steve donovan <steve.j.donovan@gmail.com>:
> On Wed, Apr 10, 2013 at 9:03 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>>
>> > However, using it for namespacing ties one to 5.2 prematurely.
>> How about giving us a little example?
>
>
> -- new style Lua 5.2 module
> local _ENV = {}
> function answer() return 42 end
> return _ENV
>
...
> But why not just
>
> local M = {}
> function M.answer() return 42 end
> return M
In fact, much rather.
I was bitten for about two weeks by the possibility of doing as
in your example, but quickly discovered that having the standard
library functions undefined except those cached as upvalues
was intensely annoying.
- 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