generate an Array using value for naming the keys?

Mark Waddingham mark at livecode.com
Thu May 11 10:36:39 EDT 2023


On 2023-05-11 14:36, matthias rebbe via use-livecode wrote:
> The middle part of the key names changes and there can be about 50 
> different "middle parts" and there are 10 main keys (after the middle 
> part)
> _content, _text _html and so on.
> 
> So without an idea i would have to create the code to fill all values 
> for the array keys with the middle part aa and then the code  for the 
> middle part cd and so on.
> 
> Is there a way to use value for this. So i could just add the middle 
> part of the key name to a variable and use that then with value() to 
> create and file the array?

Perhaps I'm misunderstanding what you are trying to do as you mention 
using value() for something which doesn't sound like it needs it...

Array keys can be arbitrary (string-valued) expressions - i.e. they 
don't have to be literal strings:

e.g. put tFoo["wp_" & tMiddlePart & "_" & tSuffix] into 
tMiddlePartSuffixValue

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things



More information about the use-livecode mailing list