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

Function runargs

deps/lua/src/lua.c:294–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292
293
294static int runargs (lua_State *L, char **argv, int n) {
295 int i;
296 for (i = 1; i < n; i++) {
297 if (argv[i] == NULL) continue;
298 lua_assert(argv[i][0] == '-');
299 switch (argv[i][1]) { /* option */
300 case 'e': {
301 const char *chunk = argv[i] + 2;
302 if (*chunk == '\0') chunk = argv[++i];
303 lua_assert(chunk != NULL);
304 if (dostring(L, chunk, "=(command line)") != 0)
305 return 1;
306 break;
307 }
308 case 'l': {
309 const char *filename = argv[i] + 2;
310 if (*filename == '\0') filename = argv[++i];
311 lua_assert(filename != NULL);
312 if (dolibrary(L, filename))
313 return 1; /* stop if file fails */
314 break;
315 }
316 default: break;
317 }
318 }
319 return 0;
320}
321
322
323static int handle_luainit (lua_State *L) {

Callers 1

pmainFunction · 0.85

Calls 2

dostringFunction · 0.85
dolibraryFunction · 0.85

Tested by

no test coverage detected