|
|
@ -5,9 +5,9 @@ namespace LuaUi
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sol::protected_function loadContentConstructor(LuaUtil::LuaState* state)
|
|
|
|
sol::protected_function loadContentConstructor(LuaUtil::LuaState* state)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sol::function loader = state->loadInternalLib("content");
|
|
|
|
sol::protected_function loader = state->loadInternalLib("content");
|
|
|
|
sol::set_environment(state->newInternalLibEnvironment(), loader);
|
|
|
|
sol::set_environment(state->newInternalLibEnvironment(), loader);
|
|
|
|
sol::table metatable = loader().get<sol::table>();
|
|
|
|
sol::table metatable = LuaUtil::LuaState::throwIfError(loader()).get<sol::table>();
|
|
|
|
if (metatable["new"].get_type() != sol::type::function)
|
|
|
|
if (metatable["new"].get_type() != sol::type::function)
|
|
|
|
throw std::logic_error("Expected function");
|
|
|
|
throw std::logic_error("Expected function");
|
|
|
|
return metatable["new"].get<sol::protected_function>();
|
|
|
|
return metatable["new"].get<sol::protected_function>();
|
|
|
|