aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs38
1 files changed, 36 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 1fc31c5..faf9c40 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -422,7 +422,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
422 422
423 public int Length 423 public int Length
424 { 424 {
425 get { 425 get
426 {
426 if (m_data == null) 427 if (m_data == null)
427 m_data=new Object[0]; 428 m_data=new Object[0];
428 return m_data.Length; 429 return m_data.Length;
@@ -431,7 +432,40 @@ namespace OpenSim.Region.ScriptEngine.Shared
431 432
432 public int Size 433 public int Size
433 { 434 {
434 get { return 0; } 435 get
436 {
437 if (m_data == null)
438 m_data=new Object[0];
439
440 int size = 0;
441
442 foreach (Object o in m_data)
443 {
444 if (o is LSL_Types.LSLInteger)
445 size += 4;
446 else if (o is LSL_Types.LSLFloat)
447 size += 8;
448 else if (o is LSL_Types.LSLString)
449 size += ((LSL_Types.LSLString)o).m_string.Length;
450 else if (o is LSL_Types.key)
451 size += ((LSL_Types.key)o).value.Length;
452 else if (o is LSL_Types.Vector3)
453 size += 32;
454 else if (o is LSL_Types.Quaternion)
455 size += 64;
456 else if (o is int)
457 size += 4;
458 else if (o is string)
459 size += ((string)o).Length;
460 else if (o is float)
461 size += 8;
462 else if (o is double)
463 size += 16;
464 else
465 throw new Exception("Unknown type in List.Size: " + o.GetType().ToString());
466 }
467 return size;
468 }
435 } 469 }
436 470
437 public object[] Data 471 public object[] Data