MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / getargs

Function getargs

lua/lua.c:114–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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