|
Escrito por Atlante Guerrero
|
|
jueves, 13 de diciembre de 2007 |
|
Página 8 de 9 LSL CONTROL de FLUJO · for for( initializer; condition; increment ) loop | • | initializer | – | Executed once just before checking condition. | | | • | condition | – | If this executes as true then loop is executed. | | | • | increment | – | Executed after loop, then condition is checked again. | | | • | loop | – | Can be either a single statement, a block statement, or a null statement. | | Any of the statements can be null statements. · if | • | condition | – | If this executes as true then branch is executed. | | | • | branch | – | Can be either a single statement, a block statement, or a null statement. | | | if ( condition ) branch_true else branch_false | • | condition | – | If this executes as true then branch_true is executed otherwise branch_false is executed. | | | • | branch_true | – | Can be either a single statement, a block statement, or a null statement. | | | • | branch_false | – | Can be either a single statement, a block statement, or a null statement. | | | | | · while | • | condition | – | If this executes as true then loop is executed. | | | • | loop | – | Can be either a single statement, a block statement, or a null statement. | | Any of the statements can be null statements. · do while do loop while (condition); | • | loop | – | Executes once, then executes condition. | | | • | condition | – | If condition executes true, it then loops back and executes loop again. | | Any of the statements can be null statements. A do...while loop is slightly faster than a while or for loop, and requires fewer bytes of memory than a while or for loop. · jump | • label | target | – | Name of a label inside the same leg of the scope hierarchy tree | | | | • label | target | – | A label that can be jumped to if the jump is in the same scope or child scope. | | | · return | • type | value | – | value or variable to be returned by the function, the type must be the same as that to be returned by the function. | | Used to return execution to the previous scope along with a value. Functions Exits the function and continues script execution in the previous scope. Events Causes the script to crash. Events cannot return a value. Use the next form of this keyword instead Used to prematurely return execution to the previous scope before reaching the end of the function/event. You do not need to use this at the end of an event or function, as it is assumed by the compiler. Functions Exits the function and continues script execution in the previous scope. Events Exits the event and removes it from the event queue. If there is another event in the queue, that event is triggered. · state | • event | events | – | one or more events | | The default state definition. | | • label | target | – | state name | | | • event | events | – | one or more events | | target state definition. | | • label | target | – | name of a state to run | | When a state target; is encountered at runtime, if the current state and the target state are different: 1. Trigger state_exit in the current state if it exists and clear the event queue. 2. Change state to target, any listens are unregistered. 3. Trigger state_entry in the target state if it exists. If target state is the same as the current state, no state change occurs nor do any of the side effects. | | | |
|
|
Modificado el ( lunes, 17 de diciembre de 2007 )
|