Brightsign BrightScript 2 Reference Guide Manuel d'utilisateur Page 32

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 59
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 31
32
m.result=m.a+m.b
end function
If a function is not called from an AssociatiaveArray, then its “m” is set to an
AssocicateArray that is global to the module, and persists across calls.
Anonymous Functions
A function is anonymous if it does not have a name. It can be declared like this;
myfunc=function (a, b)
Return a+b
end function
print myfunc(1,2)
They can be used with AA literals like this:
q = {
starring : function(o, e)
str = e.GetBody()
print "Starring: " + str
toks = box(str).tokenize(",")
for each act in tok
actx = box(act).trim()
if actx <> "" then
print "Actor: [" + actx + "]"
o.Actors.Push(actx)
endif
next
return 0
end function
}
q.starring(myobj, myxml)
Vue de la page 31
1 2 ... 27 28 29 30 31 32 33 34 35 36 37 ... 58 59

Commentaires sur ces manuels

Pas de commentaire