MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / unsafe_script_file

Method unsafe_script_file

Libs/sol/sol.hpp:25525–25537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 8

luaL_loadfilexFunction · 0.85
to_stringFunction · 0.85
set_environmentFunction · 0.85
raw_indexClass · 0.85
script_fileFunction · 0.85
stack_referenceClass · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected