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

Function handle_script

lua/lua.c:237–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235
236
237static int handle_script (lua_State *L, char **argv, int n) {
238 int status;
239 const char *fname;
240 int narg = getargs(L, argv, n); /* collect arguments */
241 lua_setglobal(L, "arg");
242 fname = argv[n];
243 if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0)
244 fname = NULL; /* stdin */
245 status = luaL_loadfile(L, fname);
246 lua_insert(L, -(narg+1));
247 if (status == 0)
248 status = docall(L, narg, 0);
249 else
250 lua_pop(L, narg);
251 return report(L, status);
252}
253
254
255/* check that argument has no extra characters at the end */

Callers 1

pmainFunction · 0.85

Calls 5

getargsFunction · 0.85
luaL_loadfileFunction · 0.85
lua_insertFunction · 0.85
docallFunction · 0.85
reportFunction · 0.85

Tested by

no test coverage detected