@@ -939,6 +939,26 @@ Sol2ScriptingEnvironment::GetStringListFromFunction(const std::string &function_
939939 return strings;
940940}
941941
942+ namespace
943+ {
944+
945+ // string list can be defined either as a Set(see profiles/lua/set.lua) or as a Sequence (see
946+ // profiles/lua/sequence.lua) `Set` is a table with keys that are actual values we are looking for
947+ // and values that always `true`. `Sequence` is a table with keys that are indices and values that
948+ // are actual values we are looking for.
949+
950+ std::string GetSetOrSequenceValue (const std::pair<sol::object, sol::object> &pair)
951+ {
952+ if (pair.second .is <std::string>())
953+ {
954+ return pair.second .as <std::string>();
955+ }
956+ BOOST_ASSERT (pair.first .is <std::string>());
957+ return pair.first .as <std::string>();
958+ }
959+
960+ } // namespace
961+
942962std::vector<std::string>
943963Sol2ScriptingEnvironment::GetStringListFromTable (const std::string &table_name)
944964{
@@ -954,7 +974,7 @@ Sol2ScriptingEnvironment::GetStringListFromTable(const std::string &table_name)
954974 {
955975 for (auto &&pair : table)
956976 {
957- strings.push_back (pair. second . as <std::string>( ));
977+ strings.emplace_back ( GetSetOrSequenceValue (pair ));
958978 }
959979 }
960980 return strings;
@@ -989,7 +1009,7 @@ Sol2ScriptingEnvironment::GetStringListsFromTable(const std::string &table_name)
9891009 std::vector<std::string> inner_vector;
9901010 for (const auto &inner_pair : inner_table)
9911011 {
992- inner_vector.push_back (inner_pair. first . as <std::string>( ));
1012+ inner_vector.emplace_back ( GetSetOrSequenceValue (inner_pair ));
9931013 }
9941014 string_lists.push_back (std::move (inner_vector));
9951015 }
0 commit comments