| 24665 | |
| 24666 | template <typename E> |
| 24667 | unsafe_function_result unsafe_script(lua_Reader reader, void* data, const basic_environment<E>& env, const std::string& chunkname = detail::default_chunk_name(), load_mode mode = load_mode::any) { |
| 24668 | detail::typical_chunk_name_t basechunkname = {}; |
| 24669 | const char* chunknametarget = detail::make_chunk_name("lua_Reader", chunkname, basechunkname); |
| 24670 | int index = lua_gettop(L); |
| 24671 | if (lua_load(L, reader, data, chunknametarget, to_string(mode).c_str())) { |
| 24672 | lua_error(L); |
| 24673 | } |
| 24674 | set_environment(env, stack_reference(L, raw_index(index + 1))); |
| 24675 | if (lua_pcall(L, 0, LUA_MULTRET, 0)) { |
| 24676 | lua_error(L); |
| 24677 | } |
| 24678 | int postindex = lua_gettop(L); |
| 24679 | int returns = postindex - index; |
| 24680 | return unsafe_function_result(L, (std::max)(postindex - (returns - 1), 1), returns); |
| 24681 | } |
| 24682 | |
| 24683 | unsafe_function_result unsafe_script(lua_Reader reader, void* data, const std::string& chunkname = detail::default_chunk_name(), load_mode mode = load_mode::any) { |
| 24684 | int index = lua_gettop(L); |
nothing calls this directly
no test coverage detected