Three very simple questions

Alex Tweedly alex at tweedly.net
Sun Apr 26 08:27:36 EDT 2020


Sorry for sending 3 replies - but I don't know when I will run out of 
time, and wanted to get some sent before the oven demands attention :-)

On 26/04/2020 13:11, Graham Samuel via use-livecode wrote:
> 3. I can’t work out if you can construct an array using the IDE, i.e. prior to actually executing the code. I was thinking for example of an array of constants (really strings) which could be written into my script. Again, if that’s possible I don’t know how. It seems odd to have to do something like convert lists of constants into array form only when the program is running. Somehow I don’t think this is possible in LC, but I’m not sure.

No easy way to do it as constants. It is odd, but easiest is to just do 
it in an "opencard" or openstack handler, with a global array.

on opencard
   put "This is the help introduction" into gStrings["help"][1]
   put "(C) 2020 Graham Samuel" into gStrings["help"[2]
   ...
end opencard


Or, you can use Custom Properties (or Property Arrays) - but I don't 
remember how; it's just easier to do it as an array.

Or you can hold it in an external text file (e.g. Tab Separated file) so 
it is easier to edit with your favourite text editor, or import from 
spreadsheet, or ...). If you do that, I'd recommend reading it into a 
(global?) array, and providing a "write back to file" function so you 
can easily update it while in the IDE, and save those changes.

Alex.




More information about the use-livecode mailing list