Exemple #1
0
        static int getargs(Lua.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.luaL_checkstack(L, narg + 3, "too many arguments to script");
            for (i = n + 1; i < argc; i++)
            {
                Lua.lua_pushstring(L, argv[i]);
            }
            Lua.lua_createtable(L, narg, n + 1);
            for (i = 0; i < argc; i++)
            {
                Lua.lua_pushstring(L, argv[i]);
                Lua.lua_rawseti(L, -2, i - n);
            }
            return(narg);
        }