| 25469 | |
| 25470 | template <typename E> |
| 25471 | unsafe_function_result unsafe_script(lua_Reader reader, void* data, const basic_environment<E>& env, |
| 25472 | const std::string& chunkname = detail::default_chunk_name(), load_mode mode = load_mode::any) { |
| 25473 | detail::typical_chunk_name_t basechunkname = {}; |
| 25474 | const char* chunknametarget = detail::make_chunk_name("lua_Reader", chunkname, basechunkname); |
| 25475 | int index = lua_gettop(L); |
| 25476 | if (lua_load(L, reader, data, chunknametarget, to_string(mode).c_str())) { |
| 25477 | lua_error(L); |
| 25478 | } |
| 25479 | set_environment(env, stack_reference(L, raw_index(index + 1))); |
| 25480 | if (lua_pcall(L, 0, LUA_MULTRET, 0)) { |
| 25481 | lua_error(L); |
| 25482 | } |
| 25483 | int postindex = lua_gettop(L); |
| 25484 | int returns = postindex - index; |
| 25485 | return unsafe_function_result(L, (std::max)(postindex - (returns - 1), 1), returns); |
| 25486 | } |
| 25487 | |
| 25488 | unsafe_function_result unsafe_script( |
| 25489 | lua_Reader reader, void* data, const std::string& chunkname = detail::default_chunk_name(), load_mode mode = load_mode::any) { |
nothing calls this directly
no test coverage detected