#ifndef MWLUA_IDCOLLECTIONBINDINGS_H #define MWLUA_IDCOLLECTIONBINDINGS_H #include #include #include namespace MWLua { template sol::table createReadOnlyRefIdTable(const sol::state_view& lua, const C& container, P projection = {}) { sol::table res(lua, sol::create); for (const auto& element : container) { ESM::RefId id = projection(element); if (!id.empty()) res.add(id.serializeText()); } return LuaUtil::makeReadOnly(res); } } #endif