[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Local variables in the main block are global
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 21 Apr 2013 09:15:15 +0200
Sorry, hit the sent button too soon. The behaviour of the
title occurs in a long module of mine, and I am still trying
to isolate it. It's not that simple. Sorry!
2013/4/21 Dirk Laurie <dirk.laurie@gmail.com>:
> Try this:
>
> ~~~ file localisglobal.lua
> setmetatable(_ENV,{__newindex = function (ENV,name,value)
> if name:match"^%a%d?$" then
> print(": A global name like '"..name.."' is asking for trouble")
> end
> rawset(ENV,name,value)
> end})
>
> local Y=2
> ~~~