LlList2String/fr

From Second Life Wiki
< LlList2String
Revision as of 11:25, 21 March 2008 by Gally Young (talk | contribs) (proofread)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

Fonction: string llList2String( list src, integer index );

Renvoie un string correspondant à l’élément à l’index du src.

• list src
• integer index

index accepte les index négatifs.
Si l’élément du list src n’est pas un string, il est alors converti en string.
Si l’index est hors de portée, la fonction renvoie un string null.

Spécifications

Index Positif Negatif
Premier 0 - longueur
Dernier longueur - 1 -1

Exemples

<lsl>//ce code illustre les différentes conversions dans le LSL (et l’utilisation des fonctions llList2* ). // Mieux visible dans l’historique du chat (ctrl-h) default {

   state_entry()
   {
       list my_list = ["a", "0xFF", "0xFF.FF", "1.0e3", 1, 2.0, <1,2,3>, <1,2,3,4>, llGetOwner()];
       integer i = 0;
       integer end = llGetListLength(my_list);
       for (; i<end; ++i)
       {
           llOwnerSay("string=" + llList2String(my_list,i)
                       + "\n   integer=" + (string)llList2Integer(my_list,i) + " OR " +(string)((integer)llList2String(my_list,i))
                       + "\n   float=" + (string)llList2Float(my_list,i) + " OR " +(string)((float)llList2String(my_list,i))
                       + "\n   vector=" + (string)llList2Vector(my_list,i) + " OR " +(string)((vector)llList2String(my_list,i))
                       + "\n   rot=" + (string)llList2Rot(my_list,i) + " OR " +(string)((rotation)llList2String(my_list,i))
                       + "\n   key=" + (string)llList2Key(my_list,i) + " OR " +(string)((key)llList2String(my_list,i)) );
       }
   }

}</lsl>

Notes

Pour convertir un string au format hexadécimal en integer, utilisez llList2String puis convertissez le résultat en integer : "(integer)valeur" Pour convertir cet integer en hexadécimal, utilisez hex.

Voir également

Fonctions

• llGetListEntryType Renvoie le type d’un élément de list
• llList2Float Renvoie un élément de list
• llList2Integer Renvoie un élément de list
• llList2Key Renvoie un élément de list

Articles

•  Negative_Index
Vous cherchez encore des informations ? Peut-être cette page du LSLwiki pourra vous renseigner.