MCPcopy Create free account
hub / github.com/crownengine/crown / handle_script

Function handle_script

3rdparty/luajit/src/luajit.c:270–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270static int handle_script(lua_State *L, char **argx)
271{
272 int status;
273 const char *fname = argx[0];
274 if (strcmp(fname, "-") == 0 && strcmp(argx[-1], "--") != 0)
275 fname = NULL; /* stdin */
276 status = luaL_loadfile(L, fname);
277 if (status == LUA_OK) {
278 /* Fetch args from arg table. LUA_INIT or -e might have changed them. */
279 int narg = 0;
280 lua_getglobal(L, "arg");
281 if (lua_istable(L, -1)) {
282 do {
283 narg++;
284 lua_rawgeti(L, -narg, narg);
285 } while (!lua_isnil(L, -1));
286 lua_pop(L, 1);
287 lua_remove(L, -narg);
288 narg--;
289 } else {
290 lua_pop(L, 1);
291 }
292 status = docall(L, narg, 0);
293 }
294 return report(L, status);
295}
296
297/* Load add-on module. */
298static int loadjitmodule(lua_State *L)

Callers 1

pmainFunction · 0.70

Calls 6

strcmpFunction · 0.85
luaL_loadfileFunction · 0.70
lua_rawgetiFunction · 0.70
lua_removeFunction · 0.70
docallFunction · 0.70
reportFunction · 0.70

Tested by

no test coverage detected