[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Overwriting variables by accident
- From: "Simon" <simon@...>
- Date: Sun, 14 Sep 2003 17:36:12 +0100
I have a small issue here (still using 4.1).
Its probably been answered a hundred times already but I cant find it
in the backlog of lua mails I have. I just want to verify the following.
Is there anyway of deterimining whether a variable you have assigned is
being overwritten/reassigned again so we can pop up an error to the user
concerned?
For example
MyPanel = foo()
then later on we've accidentally done something like this
MyPanel = foo()
When I clean up everything lua and C side the exe or lua GC can pop
depending on whats happened and it can be difficult to trace back to
what has caused the issue in the first place. The above example tends to
be reason in the current set of code I have.
Ideally I need someway of knowing that the variable is being reassigned
from nil in this case
I assume I'd have to wrap this up in a lua function like
function UI_foo(MyPanel)
if MyPanel~=nil then
-- Errror
return
end
MyPanel = CreateAPanel()
end
UI_foo(MyPanel)
But this seems to be a somewhat tedious way of doing this, is there
anyway of tying it in for example to the tag methods? Or something along
those lines? Are there any other techniques people tend to use to
minimize these sorts of problems?
regards