| 335 | |
| 336 | |
| 337 | static int luaB_load (lua_State *L) { |
| 338 | int status; |
| 339 | size_t l; |
| 340 | const char *s = lua_tolstring(L, 1, &l); |
| 341 | const char *mode = luaL_optstring(L, 3, "bt"); |
| 342 | int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */ |
| 343 | if (s != NULL) { /* loading a string? */ |
| 344 | const char *chunkname = luaL_optstring(L, 2, s); |
| 345 | status = luaL_loadbufferx(L, s, l, chunkname, mode); |
| 346 | } |
| 347 | else { /* loading from a reader function */ |
| 348 | const char *chunkname = luaL_optstring(L, 2, "=(load)"); |
| 349 | luaL_checktype(L, 1, LUA_TFUNCTION); |
| 350 | lua_settop(L, RESERVEDSLOT); /* create reserved slot */ |
| 351 | status = lua_load(L, generic_reader, NULL, chunkname, mode); |
| 352 | } |
| 353 | return load_aux(L, status, env); |
| 354 | } |
| 355 | |
| 356 | /* }====================================================== */ |
| 357 |
nothing calls this directly
no test coverage detected