From 644fb6b013b8c8598c42d19cee67201911f31c2e Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Fri, 20 Jul 2012 10:25:50 -0700
Subject: Implements a very useful OSSL function to test a string to see if it
is a UUID. The function is osIsUUID().
Thanks SignpostMarv!
---
.../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 ++++++++++++++
.../Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 +++++++
.../Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++
3 files changed, 26 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine/Shared')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 4137397..e0b4db6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3274,5 +3274,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
InitLSL();
((LSL_Api)m_LSL_Api).DetachFromAvatar();
}
+
+ ///
+ /// Checks if thing is a UUID.
+ ///
+ ///
+ /// 1 if thing is a valid UUID, 0 otherwise
+ public LSL_Integer osIsUUID(string thing)
+ {
+ CheckThreatLevel(ThreatLevel.None, "osIsUUID");
+ m_host.AddScriptLPS(1);
+
+ UUID test;
+ return UUID.TryParse(thing, out test) ? 1 : 0;
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index b5416c8..c9403eb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -276,5 +276,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osSetTerrainTexture(int level, LSL_Key texture);
void osSetTerrainTextureHeight(int corner, double low, double high);
+
+ ///
+ /// Checks if thing is a UUID.
+ ///
+ ///
+ /// 1 if thing is a valid UUID, 0 otherwise
+ LSL_Integer osIsUUID(string thing);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index b40bdf0..99995a7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -930,5 +930,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high);
}
+
+ public LSL_Integer osIsUUID(string thing)
+ {
+ return m_OSSL_Functions.osIsUUID(thing);
+ }
}
}
--
cgit v1.1