[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Protecting global variables
- From: Peter Slížik <peter.slizik@...>
- Date: Thu, 16 Aug 2012 14:49:01 +0200
> but just to avoid having to worry that something might go wrong and
> polluting the globals table you could simply define a table of your
> own (...) Then instead of writing, for instance:
>
> somestatevar = {1, 2, 3}
>
> if you named your table e.g. "engine" you would write:
>
> engine.somestatevar = {1, 2, 3}
Yes, this was exactly my idea. I'd just gather all my variables into
one table. And then I wanted to take that idea further by implementing
a mechanism like the following:
engine = nil
stdin:1: attempt to assign to a read-only variable
But I think I'll just write into the documentation: "Don't ever delete
(or re-assign) this variable, you'll be unable to access the system at
all." That should solve the problem. ;-)
Anyway, ευχαριστώ πολύ.
Peter