LSL Errors/fr

From Second Life Wiki
< LSL Errors
Revision as of 11:21, 11 December 2007 by Samia Bechir (talk | contribs) (en cours de traduction par Samia)
Jump to navigation Jump to search

Messages d'erreur pendant l'exécution (Run-time error)

L'exécution du script s'arrête, et vous avez un message d'erreur en chat : "Script run-time error", suivi d'un autre message d'erreur tel que :

Script run-time error: Heap Error (erreur de tas)

Evitez le non-sens. Par exemple, ne faites pas une liste à une seule entrée qui est le résultat d'une routine qui ne renvoie pas de résultat.

Script run-time error: Lists may not contain lists (les listes ne peuvent pas contenir de listes)

N'essayez pas d'ajouter une liste dans une liste.

Script run-time error: Math Error (erreur mathématique)

Float ou Integer divisé par zéro, etc.

Script run-time error: Stack-Heap Collision (collision entre tas et pile)

La pile est entrée en collision avec le tas ou le bytecode.

Chaque script s'exécute en utilisant 16 Ko de mémoire, partagée entre bytecode, tas et pile.

Vous pouvez provoquer une collision si vous compilez trop de scripts, ce qui produit trop de bytecode. Le script est compilé et sauvegardé sans erreur, mais lorsque vous rezzez un objet qui contient ce script, il crashe, immédiatement ou durant l'exécution.

Voir llGetFreeMemory.

Exemples de scripts provoquant Run-time error

Compilez et exécutez ces exemples pour obtenir les messages d'erreur pendant l'exécution (run-time error en chat).

default
{
    state_entry()
    {
        llOwnerSay((string) [llOwnerSay("bye")]); // Script run-time error: Heap Error (erreur de tas)
    }
}
default
{
    state_entry()
    {
        list once = [];
        list twice = [once, once]; // Script run-time error: Lists may not contain lists (les listes ne peuvent pas contenir de listes)
    }
}
default
{
    state_entry()
    {
        float one = 1.0;
        float zero = 0.0;
        float quotient = one / zero; // Script run-time error: Math Error (erreur mathématique)
        llOwnerSay((string) quotient);
    }
}
default
{
    state_entry()
    {
        list entries = [0];
        while (TRUE)
        {
            entries += entries; // Script run-time error: Stack-Heap Collision (collision tas/pile)
            llOwnerSay((string) llGetListLength(entries));
        }
    }
}

messages d'erreur pendant la compilation (Compile-time error messages)

The SL GUI may reject some code that you feel is perfectly clear, printing ERROR at you and then explaining with some further complaint.

ERROR : Type mismatch

You must name the .x .y .z .s components of a vector or rotation that you're assigning, you can't assign them all at once from a list, for instance:

default
{
    state_entry()
    {
        vector vec = (vector) [1, 2, 3]; // ERROR : Type mismatch
        llOwnerSay((string) vec);
    }
}

ERROR : Byte code assembly failed -- out of memory

You must make each script reasonably small.

For example, the compiler says you typed too much script if you cascade too many else-if's:

demoElseIfCompileError(integer count)
{
    if (count == 0)
    {
        ;
    }
    else if (count == 1)
    {
        ;
    }
    else if (count == 2)
    {
        ;
    }
    ...
    ... // ERROR : Byte code assembly failed -- out of memory
    ... // or ERROR : Syntax error
    ...
    else if (count == ...)
    {
        ;
    }
}

How much script is too much script can vary astonishingly. For example, the 2007-08 Second Life clients varied as much as 30X, from one to the next. Specifically, the Windows client accepted 22 else-if's and refused 23 else-if's, while Mac OS X was accepting 692 else-if's and refusing 693 else-if's.

Compilation limits that vary by operating system in effect work as a copy-restriction mechanism. Any resident can run the script compiled by the less limited compiler, but residents who have only the more limited compiler cannot save changes to the source.

See llGetFreeMemory, llMessageLinked.

ERROR : Syntax error

You must punctuate the script and spell the words of the script as will please the compiler, of course.

Also you must make each script reasonably small. The compiler may astonishingly complain of a "syntax" error rather than politely complaining more specifically of an "out of memory" "byte code assembly failed" error, when you make a script unreasonably large.

For example, the 2007-08 Windows Second Life client complained of a Syntax error if you cascaded too many else-if's. The exact limits enforced can vary astonishingly. For example, the 2007-08 Windows Second Life client sometimes accepted as many as 22 cascaded else-if's, but also sometimes rejected as few as 19 cascaded else-if's, depending on other details of the script.

Programmers who learned LSL on one compiler may feel that that compiler's limits are reasonable, e.g., up to five hundred cascaded else-if's in Mac OS X, while programmers trained on another compiler may feel instead that only its significantly different limits are reasonable, e.g., no more than a dozen cascaded else-if's in Windows.