| 385 | } |
| 386 | |
| 387 | static const char *reader_func(lua_State *L, void *ud, size_t *size) |
| 388 | { |
| 389 | UNUSED(ud); |
| 390 | luaL_checkstack(L, 2, "too many nested functions"); |
| 391 | copyTV(L, L->top++, L->base); |
| 392 | lua_call(L, 0, 1); /* Call user-supplied function. */ |
| 393 | L->top--; |
| 394 | if (tvisnil(L->top)) { |
| 395 | *size = 0; |
| 396 | return NULL; |
| 397 | } else if (tvisstr(L->top) || tvisnumber(L->top)) { |
| 398 | copyTV(L, L->base+4, L->top); /* Anchor string in reserved stack slot. */ |
| 399 | return lua_tolstring(L, 5, size); |
| 400 | } else { |
| 401 | lj_err_caller(L, LJ_ERR_RDRSTR); |
| 402 | return NULL; |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | LJLIB_CF(load) |
| 407 | { |
nothing calls this directly
no test coverage detected