diff options
author | Mic Bowman | 2012-07-31 10:45:37 -0700 |
---|---|---|
committer | Mic Bowman | 2012-07-31 10:45:37 -0700 |
commit | a76a289d11086dd99d345390e58a43b66b053470 (patch) | |
tree | 60b1ef6d3890d9636a1bbb9b47758847e30b88dd /OpenSim/Region/OptionalModules/Scripting | |
parent | BulletSim: update the DLLs and SOs. This fixes the exception on shutdown (diff) | |
download | opensim-SC_OLD-a76a289d11086dd99d345390e58a43b66b053470.zip opensim-SC_OLD-a76a289d11086dd99d345390e58a43b66b053470.tar.gz opensim-SC_OLD-a76a289d11086dd99d345390e58a43b66b053470.tar.bz2 opensim-SC_OLD-a76a289d11086dd99d345390e58a43b66b053470.tar.xz |
Adds support to ScriptModuleComms for region modules to export
constants to the script engine.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 74a85e2..705a847 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | |||
@@ -46,6 +46,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | |||
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private Dictionary<string,object> m_constants = new Dictionary<string,object>(); | ||
50 | |||
49 | #region ScriptInvocation | 51 | #region ScriptInvocation |
50 | protected class ScriptInvocationData | 52 | protected class ScriptInvocationData |
51 | { | 53 | { |
@@ -269,6 +271,37 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | |||
269 | Delegate fn = LookupScriptInvocation(fname); | 271 | Delegate fn = LookupScriptInvocation(fname); |
270 | return fn.DynamicInvoke(olist.ToArray()); | 272 | return fn.DynamicInvoke(olist.ToArray()); |
271 | } | 273 | } |
274 | |||
275 | /// <summary> | ||
276 | /// Operation to for a region module to register a constant to be used | ||
277 | /// by the script engine | ||
278 | /// </summary> | ||
279 | public void RegisterConstant(string cname, object value) | ||
280 | { | ||
281 | m_log.DebugFormat("[MODULE COMMANDS] register constant <{0}> with value {1}",cname,value.ToString()); | ||
282 | lock (m_constants) | ||
283 | { | ||
284 | m_constants.Add(cname,value); | ||
285 | } | ||
286 | } | ||
287 | |||
288 | /// <summary> | ||
289 | /// Operation to check for a registered constant | ||
290 | /// </summary> | ||
291 | public object LookupModConstant(string cname) | ||
292 | { | ||
293 | // m_log.DebugFormat("[MODULE COMMANDS] lookup constant <{0}>",cname); | ||
294 | |||
295 | lock (m_constants) | ||
296 | { | ||
297 | object value = null; | ||
298 | if (m_constants.TryGetValue(cname,out value)) | ||
299 | return value; | ||
300 | } | ||
301 | |||
302 | return null; | ||
303 | } | ||
304 | |||
272 | #endregion | 305 | #endregion |
273 | 306 | ||
274 | } | 307 | } |