Parent of Target
Mark Wieder
ahsoftware at sonic.net
Wed Aug 9 21:42:01 EDT 2017
On 08/09/2017 06:24 PM, Sannyasin Brahmanathaswami via use-livecode wrote:
> local sCurrentFlavorA
>
> function returnCurrentFlavor
> put sCurrentFlavorA["fruit"]
> end returnCurrentFlavor
>
> So now, with debug on you can trace easily where things are happening. so some way to track, not only "where did this come from" (which is what debug stepping is really doing) but to look "up" "Who is asking?"
> would be interesting.
I do use getter and setter routines regularly. I think your function is
useful, but won't by itself get at the question of "who changed that?",
and for that question there are at least two possible methods:
method 1:
local sCurrentFlavorA
command setCurrentFruitFlavorTo pFlavor
put pFlavor into sCurrentFlavor["fruit"]
end setCurrentFruitFlavorTo
setCurrentFruitFlavorTo "orange"
method 2:
setProp CurrentFruitFlavor pFlavor
put pFlavor into sCurrentFlavor["fruit"]
end CurrentFruitFlavor
getProp CurrentFruitFlavor
return sCurrentFlavor["fruit"]
end CurrentFruitFlavor
set the CurrentFruitFlavor of me to "orange"
get the CurrentFruitFlavor of me
By placing breakpoints into either of these methods you can track what
sets the values in the debugger, or by placing logging statements into
either you can display the stack traces as they fly by:
put pFlavor into sCurrentFlavor["fruit"]
put the executionContexts & cr after msg
--
Mark Wieder
ahsoftware at gmail.com
More information about the use-livecode
mailing list