| 11812 | } |
| 11813 | |
| 11814 | inline void script(lua_State* L, const string_view& code, const std::string& chunkname = detail::default_chunk_name(), load_mode mode = load_mode::any) { |
| 11815 | detail::typical_chunk_name_t basechunkname = {}; |
| 11816 | const char* chunknametarget = detail::make_chunk_name(code, chunkname, basechunkname); |
| 11817 | if (luaL_loadbufferx(L, code.data(), code.size(), chunknametarget, to_string(mode).c_str()) || lua_pcall(L, 0, LUA_MULTRET, 0)) { |
| 11818 | lua_error(L); |
| 11819 | } |
| 11820 | } |
| 11821 | |
| 11822 | inline void script_file(lua_State* L, const std::string& filename, load_mode mode = load_mode::any) { |
| 11823 | if (luaL_loadfilex(L, filename.c_str(), to_string(mode).c_str()) || lua_pcall(L, 0, LUA_MULTRET, 0)) { |
no test coverage detected