diff options
author | SignpostMarv | 2012-08-31 13:50:46 +0100 |
---|---|---|
committer | Melanie | 2012-08-31 14:32:33 +0100 |
commit | 794c5f5a6d464357101d3da649815251abdc9e10 (patch) | |
tree | 0f353ec3757bf77beacb0f54e66580860a229aef /OpenSim/Region/OptionalModules/Scripting | |
parent | moving assignment to new line to make next commit easier to read in diffs (diff) | |
download | opensim-SC_OLD-794c5f5a6d464357101d3da649815251abdc9e10.zip opensim-SC_OLD-794c5f5a6d464357101d3da649815251abdc9e10.tar.gz opensim-SC_OLD-794c5f5a6d464357101d3da649815251abdc9e10.tar.bz2 opensim-SC_OLD-794c5f5a6d464357101d3da649815251abdc9e10.tar.xz |
adding support for static method script invocations
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | 15 |
1 files changed, 15 insertions, 0 deletions
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 | { |