On 9/1/19 7:48 AM, Sannyasin Brahmanathaswami via use-livecode wrote:

There are two ways to go with this:

1) keep adding "keys" to the BIG global sConfigA
OR
2) we could keep the custom properties of Stack Engine (which is always open)

Does anyone have experience and has come to "best practices" for this 
architecture? And why?

One way I deal with this situation is with getter and setter functions: It's a step away from global variables and you have more control and flexibility.

# in the main "engine" stack (move sConfigA here)
local sConfigA

function configArray pKey
  if pKey is empty then
    return sConfigA # return the whole array if needed
  else
    return sConfigA[pKey] # return just the requested value
  end if
end configArray

command setConfigTo pKey, pValue
  put pValue into sConfigA[pKey]
end setConfigTo

# in the "modular" stacks you can then
setConfigTo tKey, tValue

put configArray() into tRetrievalArray
put configArray(tKey) into tValue

--
 Mark Wieder
 ahsoftw...@gmail.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to