Ejemplo n.º 1
0
        static int getargs(LuaState L, string[] argv, int n)
        {
            int narg;
            int i;
            int argc = argv.Length;             /* count total number of arguments */

            narg = argc - (n + 1);              /* number of arguments to the script */
            Lua.LuaLCheckStack(L, narg + 3, "too many arguments to script");
            for (i = n + 1; i < argc; i++)
            {
                Lua.LuaPushString(L, argv[i]);
            }
            Lua.LuaCreateTable(L, narg, n + 1);
            for (i = 0; i < argc; i++)
            {
                Lua.LuaPushString(L, argv[i]);
                Lua.LuaRawSetI(L, -2, i - n);
            }
            return(narg);
        }