lua-users home
lua-l archive

Re: Concerns regarding in env do code() end

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


<...>
> in not_present_here do
>  a = 1
> end
> will report an error on the assignment line that it attempted to index
> "(environment)" which was nil.  Now, while I imagine that someone at some point
> thought "oooh, nil environments would be useful", surely more useful would be
> that the 'in ... do' line cause an error along the lines of "Unable to set
> environment: expected table, got nil" ?
<...>
It is really hard to code serious stuff in Lua without some kind of
global environment protection (like etc/strict.lua). Such protection
would have caught this error. If you do not use one, you should know
what you're doing.
Alexander.

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