aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorBlueWall2016-08-03 10:26:57 -0400
committerUbitUmarov2016-08-03 22:24:04 +0100
commite15dc7211311b2fe6ca83cb12d80a5c9d1ad0ef5 (patch)
tree41cd6e3ff9b66c46da84488f6cc1cd5032f3ccc3 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentreduce ubOde walking super climbers (diff)
downloadopensim-SC-e15dc7211311b2fe6ca83cb12d80a5c9d1ad0ef5.zip
opensim-SC-e15dc7211311b2fe6ca83cb12d80a5c9d1ad0ef5.tar.gz
opensim-SC-e15dc7211311b2fe6ca83cb12d80a5c9d1ad0ef5.tar.bz2
opensim-SC-e15dc7211311b2fe6ca83cb12d80a5c9d1ad0ef5.tar.xz
Provide tests for native datatypes where LSL Constants are used in lists as JSON elements. Namely: LSL_Float/double, LSL_String/string, LSL_Integer/int. Fixes http://opensimulator.org/mantis/view.php?id=7957
Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs30
1 files changed, 24 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e074af2..cf61943 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -16426,11 +16426,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16426 16426
16427 private OSD ListToJson(object o) 16427 private OSD ListToJson(object o)
16428 { 16428 {
16429 if (o is LSL_Float) 16429 if (o is LSL_Float || o is double)
16430 return OSD.FromReal(((LSL_Float)o).value);
16431 if (o is LSL_Integer)
16432 { 16430 {
16433 int i = ((LSL_Integer)o).value; 16431 double float_val;
16432 if (o is double)
16433 float_val = ((double)o);
16434 else
16435 float_val = ((LSL_Float)o).value;
16436
16437 return OSD.FromReal(float_val);
16438 }
16439 if (o is LSL_Integer || o is int)
16440 {
16441 int i;
16442 if (o is int)
16443 i = ((int)o);
16444 else
16445 i = ((LSL_Integer)o).value;
16446
16434 if (i == 0) 16447 if (i == 0)
16435 return OSD.FromBoolean(false); 16448 return OSD.FromBoolean(false);
16436 else if (i == 1) 16449 else if (i == 1)
@@ -16441,9 +16454,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16441 return OSD.FromString(((LSL_Rotation)o).ToString()); 16454 return OSD.FromString(((LSL_Rotation)o).ToString());
16442 if (o is LSL_Vector) 16455 if (o is LSL_Vector)
16443 return OSD.FromString(((LSL_Vector)o).ToString()); 16456 return OSD.FromString(((LSL_Vector)o).ToString());
16444 if (o is LSL_String) 16457 if (o is LSL_String || o is string)
16445 { 16458 {
16446 string str = ((LSL_String)o).m_string; 16459 string str;
16460 if (o is string)
16461 str = ((string)o);
16462 else
16463 str = ((LSL_String)o).m_string;
16464
16447 if (str == ScriptBaseClass.JSON_NULL) 16465 if (str == ScriptBaseClass.JSON_NULL)
16448 return new OSD(); 16466 return new OSD();
16449 return OSD.FromString(str); 16467 return OSD.FromString(str);