void Start()
 {
     for (int i = 0; i < phoneyCommands.Length; i++) //Add phoney commands to GConsole.
     {
         GConsole.AddCommand(phoneyCommands[i], phoneyDescriptions[i], PhoneyCommand);
     }
 }
Пример #2
0
    static int AddCommand(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 4);
        string arg0 = LuaScriptMgr.GetLuaString(L, 1);
        string arg1 = LuaScriptMgr.GetLuaString(L, 2);
        Func <string, string> arg2 = null;
        LuaTypes funcType3         = LuaDLL.lua_type(L, 3);

        if (funcType3 != LuaTypes.LUA_TFUNCTION)
        {
            arg2 = (Func <string, string>)LuaScriptMgr.GetNetObject(L, 3, typeof(Func <string, string>));
        }
        else
        {
            LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 3);
            arg2 = (param0) =>
            {
                int top = func.BeginPCall();
                LuaScriptMgr.Push(L, param0);
                func.PCall(top, 1);
                object[] objs = func.PopValues(top);
                func.EndPCall(top);
                return((string)objs[0]);
            };
        }

        string arg3 = LuaScriptMgr.GetLuaString(L, 4);
        bool   o    = GConsole.AddCommand(arg0, arg1, arg2, arg3);

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Пример #3
0
 private void LoadBuiltInCommands()
 {
     GConsole.AddCommand("help", "Show help on how to use the console", HelpConsoleCommand);
 }
Пример #4
0
 void Start()
 {
     GConsole.AddCommand("quit", "Quits the application.", QuitApplication);
 }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     GConsole.AddCommand("volume", "Changes the volume, value between 0 and 1",
                         ChangeVolume,
                         "Usage: volume [value between 0 and 1]\nExample \"volume 0.5\" puts volume at 50%");
 }