[rkward-devel] new JS functions

meik michalke Meik.Michalke at uni-duesseldorf.de
Tue Oct 18 14:28:20 UTC 2011


hi,

i just added two new JS functions to trunk:

 - shortName()
   JS equivalent to rk.get.short.name(), i.e. turn
   my.data.frame[["var1"]] and my.list[["var1"]][["var2"]]
   into var1 and var2

 - getValueShort()
   a getValue() alternative for varslots, to get an array of
   short names directly

examples:

function calculate(){
  // read in variables from dialog
  // long way:
  var myVarslot1 = getValue("my_varslot");
  myVarslot1 = shortName(myVarslot1);
  myVarslot1 = myVarslot1.join(", ");
  echo("c(" + myVarslot1 + ")");

  // shortcut:
  var myVarslot2 = getValueShort("my_varslot").join(", ");
  echo("c(" + myVarslot2 + ")");
}

what do you think?

i put them to rkward/scriptbackends/common.js -- is that a good place? i could 
probably come up with some more functions to ease the JS coding part for 
rather common stuff. 


viele grüße :: m.eik

-- 
  dipl. psych. meik michalke
  abt. f"ur diagnostik und differentielle psychologie
  institut f"ur experimentelle psychologie
  heinrich-heine-universit"at d"usseldorf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20111018/872d493c/attachment.sig>


More information about the Rkward-devel mailing list