aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs64
1 files changed, 63 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 85abdb0..4713283 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -421,6 +421,58 @@ namespace OpenSim.Region.ScriptEngine.Shared
421 } 421 }
422 } 422 }
423 423
424 // Member functions to obtain item as specific types.
425 // For cases where implicit conversions would apply if items
426 // were not in a list (e.g. integer to float, but not float
427 // to integer) functions check for alternate types so as to
428 // down-cast from Object to the correct type.
429 // Note: no checks for item index being valid are performed
430
431 public LSL_Types.LSLFloat GetLSLFloatItem( int itemIndex )
432 {
433 if (m_data[itemIndex] is LSL_Types.LSLInteger)
434 {
435 return (LSL_Types.LSLInteger)m_data[itemIndex];
436 }
437 else
438 {
439 return (LSL_Types.LSLFloat)m_data[itemIndex];
440 }
441 }
442
443 public LSL_Types.LSLString GetLSLStringItem(int itemIndex)
444 {
445 if (m_data[itemIndex] is LSL_Types.key)
446 {
447 return (LSL_Types.key)m_data[itemIndex];
448 }
449 else
450 {
451 return (LSL_Types.LSLString)m_data[itemIndex];
452 }
453 }
454
455 public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex)
456 {
457 return (LSL_Types.LSLInteger)m_data[itemIndex];
458 }
459
460 public LSL_Types.Vector3 GetVector3Item(int itemIndex)
461 {
462 return (LSL_Types.Vector3)m_data[itemIndex];
463 }
464
465 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
466 {
467 return (LSL_Types.Quaternion)m_data[itemIndex];
468 }
469
470 public LSL_Types.key GetKeyItem(int itemIndex)
471 {
472 return (LSL_Types.key)m_data[itemIndex];
473 }
474
475
424 public static list operator +(list a, list b) 476 public static list operator +(list a, list b)
425 { 477 {
426 object[] tmp; 478 object[] tmp;
@@ -1164,7 +1216,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
1164 1216
1165 static public implicit operator String(key k) 1217 static public implicit operator String(key k)
1166 { 1218 {
1167 return k.value; 1219 return k.value;
1220 }
1221
1222 static public implicit operator LSLString(key k)
1223 {
1224 return k.value;
1168 } 1225 }
1169 1226
1170 public static bool operator ==(key k1, key k2) 1227 public static bool operator ==(key k1, key k2)
@@ -1190,6 +1247,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
1190 return value.GetHashCode(); 1247 return value.GetHashCode();
1191 } 1248 }
1192 1249
1250 public override string ToString()
1251 {
1252 return value;
1253 }
1254
1193 #endregion 1255 #endregion
1194 } 1256 }
1195 1257