NET:LavishScriptAPI.Delegates.CommandTarget

From Lavish Software Wiki
Jump to: navigation, search

Overview

LavishScriptAPI.Delegates.CommandTarget describes the delegate used to implement LavishScript commands through .NET.

Reference Library

Lavish.InnerSpace.dll

Fully Qualified Name

LavishScriptAPI.Delegates.CommandTarget

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]);
               }
            }
        }

See Also