diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | 15 |
2 files changed, 24 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs index ff8213c..dae7c00 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs | |||
@@ -54,9 +54,9 @@ namespace OpenSim.Region.Framework.Interfaces | |||
54 | void RegisterScriptInvocation(object target, string method); | 54 | void RegisterScriptInvocation(object target, string method); |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Register an instance method as a script call by method info | 57 | /// Register a static or instance method as a script call by method info |
58 | /// </summary> | 58 | /// </summary> |
59 | /// <param name="target"></param> | 59 | /// <param name="target">If target is a Type object, will assume method is static.</param> |
60 | /// <param name="method"></param> | 60 | /// <param name="method"></param> |
61 | void RegisterScriptInvocation(object target, MethodInfo method); | 61 | void RegisterScriptInvocation(object target, MethodInfo method); |
62 | 62 | ||
@@ -68,6 +68,13 @@ namespace OpenSim.Region.Framework.Interfaces | |||
68 | void RegisterScriptInvocation(object target, string[] methods); | 68 | void RegisterScriptInvocation(object target, string[] methods); |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Register one or more static methods as script calls by method name | ||
72 | /// </summary> | ||
73 | /// <param name="target"></param> | ||
74 | /// <param name="methods"></param> | ||
75 | void RegisterScriptInvocation(Type target, string[] methods); | ||
76 | |||
77 | /// <summary> | ||
71 | /// Returns an array of all registered script calls | 78 | /// Returns an array of all registered script calls |
72 | /// </summary> | 79 | /// </summary> |
73 | /// <returns></returns> | 80 | /// <returns></returns> |
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index bbaac3e..d6d96c9 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | |||
@@ -181,7 +181,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | |||
181 | } | 181 | } |
182 | 182 | ||
183 | Delegate fcall; | 183 | Delegate fcall; |
184 | if (!(target is Type)) | ||
184 | fcall = Delegate.CreateDelegate(delegateType, target, mi); | 185 | fcall = Delegate.CreateDelegate(delegateType, target, mi); |
186 | else | ||
187 | fcall = Delegate.CreateDelegate(delegateType, (Type)target, mi.Name); | ||
185 | 188 | ||
186 | lock (m_scriptInvocation) | 189 | lock (m_scriptInvocation) |
187 | { | 190 | { |
@@ -196,6 +199,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | |||
196 | m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); | 199 | m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); |
197 | } | 200 | } |
198 | } | 201 | } |
202 | |||
203 | public void RegisterScriptInvocation(Type target, string[] methods) | ||
204 | { | ||
205 | foreach (string method in methods) | ||
206 | { | ||
207 | MethodInfo mi = GetMethodInfoFromType(target, method, false); | ||
208 | if (mi == null) | ||
209 | m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", method); | ||
210 | else | ||
211 | RegisterScriptInvocation(target, mi); | ||
212 | } | ||
213 | } | ||
199 | 214 | ||
200 | public Delegate[] GetScriptInvocationList() | 215 | public Delegate[] GetScriptInvocationList() |
201 | { | 216 | { |