Difference between revisions of "NET:LavishScriptAPI.Delegates.CommandTarget"
Jump to navigation
Jump to search
(→C#) |
|||
Line 24: | Line 24: | ||
== Examples == | == Examples == | ||
=== C# === | === C# === | ||
− | ; Simple command that will echo each individual argument in the form #=value. This example does not show adding the command to LavishScript or later removing the command. | + | ; Simple command that will echo each individual argument in the form #=value. This example does not show adding the command to LavishScript or later removing the command. |
− | + | using InnerSpaceAPI; | |
− | + | using LavishScriptAPI; | |
− | + | using LavishVMAPI; | |
− | + | ||
− | + | static public int MyCommand(string[] args) | |
− | + | { | |
− | + | using (new FrameLock(true)) | |
− | + | { | |
− | + | InnerSpace.Echo("MyCommand ("+args.Length.ToString()+" args)"); | |
− | + | for (int i = 0; i < args.Length; i++) | |
− | + | { | |
− | + | InnerSpace.Echo(i.ToString() + ": " + args[i]); | |
− | + | } | |
− | + | } | |
− | + | } | |
== See Also == | == See Also == |
Latest revision as of 16:37, 7 March 2008
Contents
Overview
LavishScriptAPI.Delegates.CommandTarget describes the delegate used to implement LavishScript commands through .NET.
Reference Library
Fully Qualified Name
- LavishScriptAPI.Delegates.CommandTarget
- LavishScriptAPI namespace
- Delegates namespace
- CommandTarget delegate
- Delegates namespace
Declaration
public delegate int CommandTarget([In] string[] args);
Parameters
- [In] string[] args
- The individual parameters passed to this command. The first parameter (args[0]) is always the name of the command (modelled after C console program design).
Return Value
- int
- The command's return value. A negative value indicates a "fatal" error, which would end a LavishScript script. Any further return value specialization is command-specific.
Examples
C#
; Simple command that will echo each individual argument in the form #=value. This example does not show adding the command to LavishScript or later removing the command. using InnerSpaceAPI; using LavishScriptAPI; using LavishVMAPI; static public int MyCommand(string[] args) { using (new FrameLock(true)) { InnerSpace.Echo("MyCommand ("+args.Length.ToString()+" args)"); for (int i = 0; i < args.Length; i++) { InnerSpace.Echo(i.ToString() + ": " + args[i]); } } }