Difference between revisions of "LlForeach"

From Second Life Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
<pre>
integer llForeach(array name);
integer llForeach(array name);
   instructions;
   instructions;
llEndForeach;
llEndForeach;
</pre>


walks through the {{LSLG|Array}} name
walks through the {{LSLG|Array}} name
Returns 0 if array name does not exist and 1 otherwise.
Returns 0 if array name does not exist and 1 otherwise.
===Reasons against this proposal in its current incarnation===
#This proposed syntax does not fit with the style of LSL. The C# syntax for [http://msdn2.microsoft.com/en-us/library/ttw7t8t6.aspx foreach] would be more in place with LSL.
#The function return is nonsensical, the code shouldn't compile if the array doesn't exist. LSL is strong typed.
#Because of LSL's strongly typed bytecode, support for heterogeneous lists or arrays would be if not impossible, cumbersome.
#New bytecodes would have to be implemented for this feature not to very bytecode intensive.

Latest revision as of 16:34, 27 July 2007

integer llForeach(array name);
   instructions;
llEndForeach;

walks through the Array name Returns 0 if array name does not exist and 1 otherwise.

Reasons against this proposal in its current incarnation

  1. This proposed syntax does not fit with the style of LSL. The C# syntax for foreach would be more in place with LSL.
  2. The function return is nonsensical, the code shouldn't compile if the array doesn't exist. LSL is strong typed.
  3. Because of LSL's strongly typed bytecode, support for heterogeneous lists or arrays would be if not impossible, cumbersome.
  4. New bytecodes would have to be implemented for this feature not to very bytecode intensive.