diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 44fdd1a..9ca5ca9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -544,21 +544,33 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
544 | 544 | ||
545 | set {m_data = value; } | 545 | set {m_data = value; } |
546 | } | 546 | } |
547 | // Function to obtain LSL type from an index. This is needed | 547 | |
548 | // because LSL lists allow for multiple types, and safely | 548 | /// <summary> |
549 | // iterating in them requires a type check. | 549 | /// Obtain LSL type from an index. |
550 | /// </summary> | ||
551 | /// <remarks> | ||
552 | /// This is needed because LSL lists allow for multiple types, and safely | ||
553 | /// iterating in them requires a type check. | ||
554 | /// </remarks> | ||
555 | /// <returns></returns> | ||
556 | /// <param name='itemIndex'></param> | ||
550 | public Type GetLSLListItemType(int itemIndex) | 557 | public Type GetLSLListItemType(int itemIndex) |
551 | { | 558 | { |
552 | return m_data[itemIndex].GetType(); | 559 | return m_data[itemIndex].GetType(); |
553 | } | 560 | } |
554 | 561 | ||
555 | // Member functions to obtain item as specific types. | 562 | /// <summary> |
556 | // For cases where implicit conversions would apply if items | 563 | /// Obtain float from an index. |
557 | // were not in a list (e.g. integer to float, but not float | 564 | /// </summary> |
558 | // to integer) functions check for alternate types so as to | 565 | /// <remarks> |
559 | // down-cast from Object to the correct type. | 566 | /// For cases where implicit conversions would apply if items |
560 | // Note: no checks for item index being valid are performed | 567 | /// were not in a list (e.g. integer to float, but not float |
561 | 568 | /// to integer) functions check for alternate types so as to | |
569 | /// down-cast from Object to the correct type. | ||
570 | /// Note: no checks for item index being valid are performed | ||
571 | /// </remarks> | ||
572 | /// <returns></returns> | ||
573 | /// <param name='itemIndex'></param> | ||
562 | public LSL_Types.LSLFloat GetLSLFloatItem(int itemIndex) | 574 | public LSL_Types.LSLFloat GetLSLFloatItem(int itemIndex) |
563 | { | 575 | { |
564 | if (m_data[itemIndex] is LSL_Types.LSLInteger) | 576 | if (m_data[itemIndex] is LSL_Types.LSLInteger) |
@@ -589,26 +601,14 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
589 | 601 | ||
590 | public LSL_Types.LSLString GetLSLStringItem(int itemIndex) | 602 | public LSL_Types.LSLString GetLSLStringItem(int itemIndex) |
591 | { | 603 | { |
592 | if (m_data[itemIndex] is LSL_Types.key) | 604 | if (m_data[itemIndex] is LSL_Types.key) |
593 | { | 605 | { |
594 | return (LSL_Types.key)m_data[itemIndex]; | 606 | return (LSL_Types.key)m_data[itemIndex]; |
595 | } | 607 | } |
596 | else if (m_data[itemIndex] is String) | 608 | else |
597 | { | 609 | { |
598 | return new LSL_Types.LSLString((string)m_data[itemIndex]); | 610 | return new LSL_Types.LSLString(m_data[itemIndex].ToString()); |
599 | } | 611 | } |
600 | else if (m_data[itemIndex] is LSL_Types.LSLFloat) | ||
601 | { | ||
602 | return new LSL_Types.LSLString((LSLFloat)m_data[itemIndex]); | ||
603 | } | ||
604 | else if (m_data[itemIndex] is LSL_Types.LSLInteger) | ||
605 | { | ||
606 | return new LSL_Types.LSLString((LSLInteger)m_data[itemIndex]); | ||
607 | } | ||
608 | else | ||
609 | { | ||
610 | return (LSL_Types.LSLString)m_data[itemIndex]; | ||
611 | } | ||
612 | } | 612 | } |
613 | 613 | ||
614 | public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex) | 614 | public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex) |