MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / getargs

Function getargs

deps/lua/src/lua.c:116–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115
116static int getargs (lua_State *L, char **argv, int n) {
117 int narg;
118 int i;
119 int argc = 0;
120 while (argv[argc]) argc++; /* count total number of arguments */
121 narg = argc - (n + 1); /* number of arguments to the script */
122 luaL_checkstack(L, narg + 3, "too many arguments to script");
123 for (i=n+1; i < argc; i++)
124 lua_pushstring(L, argv[i]);
125 lua_createtable(L, narg, n + 1);
126 for (i=0; i < argc; i++) {
127 lua_pushstring(L, argv[i]);
128 lua_rawseti(L, -2, i - n);
129 }
130 return narg;
131}
132
133
134static int dofile (lua_State *L, const char *name) {

Callers 1

handle_scriptFunction · 0.85

Calls 4

luaL_checkstackFunction · 0.85
lua_pushstringFunction · 0.85
lua_createtableFunction · 0.85
lua_rawsetiFunction · 0.85

Tested by

no test coverage detected