MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaB_load

Function luaB_load

3rd/lua-5.4.3/src/lbaselib.c:366–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364
365
366static int luaB_load (lua_State *L) {
367 int status;
368 size_t l;
369 const char *s = lua_tolstring(L, 1, &l);
370 const char *mode = luaL_optstring(L, 3, "bt");
371 int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */
372 if (s != NULL) { /* loading a string? */
373 const char *chunkname = luaL_optstring(L, 2, s);
374 status = luaL_loadbufferx(L, s, l, chunkname, mode);
375 }
376 else { /* loading from a reader function */
377 const char *chunkname = luaL_optstring(L, 2, "=(load)");
378 luaL_checktype(L, 1, LUA_TFUNCTION);
379 lua_settop(L, RESERVEDSLOT); /* create reserved slot */
380 status = lua_load(L, generic_reader, NULL, chunkname, mode);
381 }
382 return load_aux(L, status, env);
383}
384
385/* }====================================================== */
386

Callers

nothing calls this directly

Calls 6

lua_tolstringFunction · 0.85
luaL_loadbufferxFunction · 0.85
luaL_checktypeFunction · 0.85
lua_settopFunction · 0.85
lua_loadFunction · 0.85
load_auxFunction · 0.85

Tested by

no test coverage detected