On 28/06/2017 23:32, Alex Tweedly via use-livecode wrote:
Yes, it would be nice if we had an easier (terser) way to assign to an array. Maybe something like Python / Perl use to assign to a dictionary.

put { "name": "my chart", "width": 100, "label": "This is a chart", "anarray": sAMine } into tA
   DoSomething tA
OK, here I go answering my own post (again).

function _
  local tA
  repeat with i = 1 to paramcount()
     put param(i+1) into tA[param(i)]
  end repeat
  return tA
end _

and then I can do

put _("name","my chart", "width",100, "label","This is a chart", "anarray",sAMine) into tA
DoSomething tA

or, indeed, even

DoSomething _("name","my chart", "width",100, "label","This is a chart", "anarray",sAMine)

Still doesn't handle pass-by-reference - but that's a problem even with variable numbers of params in LC, so I'll accept it for this case.

-- Alex.

_______________________________________________
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