Script Only Stacks and Script Locals

Mark Wieder mwieder at ahsoftware.net
Fri Jul 15 22:41:39 EDT 2016


On 07/15/2016 06:34 PM, Sannyasin Brahmanathaswami wrote:

> But now it seems we've come full circle.
<lotsa stuff snipped>

Or just have getter/setter functions in the backscript and avoid global 
variables altogether:

# aMediaItemData is private to the backscript
local aMediaItemData

-- but you can still get to it
function MediaItemData pKey
	if pKey is empty then
		-- return the entire array
		return aMediaItemData
	else
		return aMediaItemData[pKey]
	end if
end MediaItemData

on SetMediaItemData pKey, pValue
	put pValue into aMediaItemData[pKey]
end SetMediaItemData

...then from your stack:

SetMediaItemData "KeyString", "ValueString"
put MediaItemData() into aBigArray
put MediaItemData(someKey) into aVariable

-- 
  Mark Wieder
  ahsoftware at gmail.com




More information about the use-livecode mailing list