On 7/15/2016 8:34 PM, Sannyasin Brahmanathaswami wrote:
There is no such thing really as "a" backscript, singular. I was
always under the impression that inserting into back would be like
concatenating scripts into one giant "backscript"
Actually, they have always been independently layered scripts. The most
recently inserted backscript is "behind" other backscripts. Since
commands usually go through the card layer first, you don't often notice
the layering. But if you have the same handler name in two backscripts,
their layer can make a difference, which is why that situation should be
avoided.
Frontscripts work the same way, but in the other direction. The most
recently inserted frontscipt is "in front" of any others.
But what we see now is that every script inserted into "back" is
encapsulated, if indeed, as you say… "No… the script locals from
"inserted script 1" are not available to handlers in "inserted script
2".
Right. A script-local variable's scope is limited to the script that
contains it.
This is important in terms of architecture that seeks to avoid use of
globals, but at the same time wants to try to follow "single
instance/class " in a MVC framework as much as possible…
Aside from the three methods you mentioned (custom properties, globals,
huge array) there's another one. I often create one-line functions that
return the script local when requested:
function getSMediaItemData
return sMediaItemData
end getSMediaItemData
That gives you the limited scope of a script local but also provides
accessibility from anywhere.
--
Jacqueline Landman Gay | [email protected]
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode