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

Function handle_script

deps/lua/src/lua.c:239–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237
238
239static int handle_script (lua_State *L, char **argv, int n) {
240 int status;
241 const char *fname;
242 int narg = getargs(L, argv, n); /* collect arguments */
243 lua_setglobal(L, "arg");
244 fname = argv[n];
245 if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0)
246 fname = NULL; /* stdin */
247 status = luaL_loadfile(L, fname);
248 lua_insert(L, -(narg+1));
249 if (status == 0)
250 status = docall(L, narg, 0);
251 else
252 lua_pop(L, narg);
253 return report(L, status);
254}
255
256
257/* 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