Enumeration is great if you need sequential numbers in your variables.
Joe
--
You received this message because you are subscribed to the Google Groups "SuperCard Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
supercard-tal...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/supercard-talk/c8d46913-7cb9-4356-831c-61c22270adacn%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "SuperCard Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supercard-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/supercard-talk/5A46CF79-3F12-440B-849B-62983EA33F99%40aol.com.
| but you can roll your own equivalent using 'by reference' parameters:
I should have scratched my head a little more regarding the 'by reference' parameters!
I have adapted and tested your example for my immediate need, which is the result of a long spaghetti function that returns a RETURN and COMMA list of datas.
For the benefit of SC users, here is a practical application. The instructions:
1- Declare the list of variables in your script, local or global.
2- Insert the coertion command and elaborate your list of variables
3- The first parameter being the list you want to elaborate
4- Elaboration your list of variables in the same order as returned list of datas and add the @ as a prefix for each of them.
5- The last [Optional] one being a different item delimiter than the default item delimiter.
The sample command below has a maximum capacity of twelve variables, the actual count may be less.
------ (Sorry I can't get the coloured formatting to work, copy and paste in your editor)
on mouseUp
local LaListe,P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12
put ListOfPastas() into LaListe
CoerParams LaListe,@P01,@P02,@P03,@P04,@P05,@P06,@P07,@P08,@P09,@P10,@P11,@P12,CR
-- For demonstration of the resulting coertion in the variables
-- TRACE -- To view to content of each variables in the ScriptEditor window
answer P01&cr&P02&cr&P03&cr&P04&cr&P05&cr&P06&cr&P07&cr&P08&cr&P09&cr&P10&cr&P11&cr&P12
end mouseUp
on CoerParams ListeParametres
-- CoerParams ListeParametres -- Mark Lucas 2021
local X=2,NbrItems=ParamCount()
put TAB&&CR&&COMMA into ListeSeparateurs
put the itemDelimiter into SCtid
if ListeSeparateurs contains param(NbrItems) then set the itemDelimiter to param(NbrItems)
repeat for each item LaVariable of ListeParametres
if X > NbrItems then exit script
put LaVariable into param(X)
add 1 to X
end repeat
set the itemDelimiter to SCtid
end CoerParams
function ListOfPastas -- A test result of a CR and COMMA list
return "Fettuccine "&COMMA&"Ribbon of pasta approximately 6.5 millimeters wide. Larger and thicker than tagliatelle "&CR&"Fileja "&COMMA&"Elongated screw "&CR&"Linguine "&COMMA&"Flattened spaghetti or Little tongues "&CR&"Lagane "&COMMA&"Wide pasta square or rectangle sheets of pasta that sometimes have fluted edges "&CR&"Lasagnette "&COMMA&"Narrower version of Lasagna or Little lasagna "&CR&"Lasagnotte "&COMMA&"Longer version of Lasaga or Bigger lasagna "&CR&"Maccheroncini di Campofilone "&COMMA&"Thin strands of egg-based pasta. Similar to Capelli d'angelo "&CR&"Mafalde "&COMMA&"Long rectangular ribbons with ruffled sides. "&COMMA&"Named in honor of Princess Mafalda of Savoy "&CR&"Matriciani "&COMMA&"Similar to perciatelli, but folded over rather than hollowed out "&CR&"Pappardelle "&COMMA&"Thick flat ribbons[29] of egg-based dough "&COMMA&"From Tuscan papparsi: to pig out"&CR&"Perciatelli "&COMMA&"From perciare :to hollow"
end ListOfPastas
For posterity, you don't actually need to save and restore the itemDel in that function (unless you've set the localDelimiters to false), or to copy the output of your ListOfPastas function to an intermediate variable.
To grab the colorization (assuming it's turned on) use the Copy With Indent option (in SC the shortcut for that is Command-Shift-C).
Also (just for the sake of a sexier-looking example ;-) in the current release if you switch the secondary delimiter from comma to tab you can use ask list ... style to gussy up that output a bit.
In the case that the last parameter passed is EMPTY, the global delimiterChar = param(NbrItems) will be EMPTY, trying to set the itemDelimiter to delimiterChar to EMPTY will provoke a SuperCar error.
--
You received this message because you are subscribed to the Google Groups "SuperCard Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supercard-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/supercard-talk/2F42C5EF-DBE8-4505-98C6-FB34B5156EA6%40aol.com.
That's not what my testing here seems to indicate.Can you post a sample script demonstrating this behavior?