| 4 | namespace LuaUi |
| 5 | { |
| 6 | sol::protected_function loadContentConstructor(LuaUtil::LuaState* state) |
| 7 | { |
| 8 | sol::protected_function loader = state->loadInternalLib("content"); |
| 9 | sol::set_environment(state->newInternalLibEnvironment(), loader); |
| 10 | sol::table metatable = LuaUtil::LuaState::throwIfError(loader()).get<sol::table>(); |
| 11 | if (metatable["new"].get_type() != sol::type::function) |
| 12 | throw std::logic_error("Expected function"); |
| 13 | return metatable["new"].get<sol::protected_function>(); |
| 14 | } |
| 15 | |
| 16 | bool isValidContent(const sol::object& object) |
| 17 | { |