| 25523 | |
| 25524 | template <typename E> |
| 25525 | unsafe_function_result unsafe_script_file(const std::string& filename, const basic_environment<E>& env, load_mode mode = load_mode::any) { |
| 25526 | int index = lua_gettop(L); |
| 25527 | if (luaL_loadfilex(L, filename.c_str(), to_string(mode).c_str())) { |
| 25528 | lua_error(L); |
| 25529 | } |
| 25530 | set_environment(env, stack_reference(L, raw_index(index + 1))); |
| 25531 | if (lua_pcall(L, 0, LUA_MULTRET, 0)) { |
| 25532 | lua_error(L); |
| 25533 | } |
| 25534 | int postindex = lua_gettop(L); |
| 25535 | int returns = postindex - index; |
| 25536 | return unsafe_function_result(L, (std::max)(postindex - (returns - 1), 1), returns); |
| 25537 | } |
| 25538 | |
| 25539 | unsafe_function_result unsafe_script_file(const std::string& filename, load_mode mode = load_mode::any) { |
| 25540 | int index = lua_gettop(L); |
nothing calls this directly
no test coverage detected