1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00
OpenMW/components/lua_ui/content.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
519 B
C++
Raw Normal View History

2021-11-18 15:19:54 +00:00
#include "content.hpp"
namespace LuaUi::Content
2021-11-18 15:19:54 +00:00
{
2023-01-31 18:50:33 +00:00
sol::protected_function loadConstructor(LuaUtil::LuaState* state)
2021-11-18 15:19:54 +00:00
{
2023-01-31 18:50:33 +00:00
sol::function loader = state->loadInternalLib("content");
sol::set_environment(state->newInternalLibEnvironment(), loader);
sol::table metatable = loader().get<sol::table>();
if (metatable["new"].get_type() != sol::type::function)
throw std::logic_error("Expected function");
return metatable["new"].get<sol::protected_function>();
2021-11-18 15:19:54 +00:00
}
}