Fix bug with reading Set values from Lua scripts.
This commit is contained in:
parent
06b1b980bb
commit
c7e48b5598
@ -3,6 +3,7 @@
|
|||||||
- API:
|
- API:
|
||||||
- FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
|
- FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
|
||||||
- Build:
|
- Build:
|
||||||
|
- CHANGED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285)
|
||||||
- CHANGED: Enable even more clang-tidy checks. [#6273](https://github.com/Project-OSRM/osrm-backend/pull/6273)
|
- CHANGED: Enable even more clang-tidy checks. [#6273](https://github.com/Project-OSRM/osrm-backend/pull/6273)
|
||||||
- CHANGED: Configure CMake to not build flatbuffers tests and samples. [#6274](https://github.com/Project-OSRM/osrm-backend/pull/6274)
|
- CHANGED: Configure CMake to not build flatbuffers tests and samples. [#6274](https://github.com/Project-OSRM/osrm-backend/pull/6274)
|
||||||
- CHANGED: Enable more clang-tidy checks. [#6270](https://github.com/Project-OSRM/osrm-backend/pull/6270)
|
- CHANGED: Enable more clang-tidy checks. [#6270](https://github.com/Project-OSRM/osrm-backend/pull/6270)
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Feature: Foot - Turn restrictions
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | sj,wj,wj |
|
| s | w | sj,wj,wj |
|
||||||
| s | n | sj,nj,nj |
|
| s | n | sj,nj |
|
||||||
| s | e | sj,ej,ej |
|
| s | e | sj,ej,ej |
|
||||||
|
|
||||||
@only_turning
|
@only_turning
|
||||||
@ -55,7 +55,7 @@ Feature: Foot - Turn restrictions
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| s | w | sj,wj,wj |
|
| s | w | sj,wj,wj |
|
||||||
| s | n | sj,nj,nj |
|
| s | n | sj,nj |
|
||||||
| s | e | sj,ej,ej |
|
| s | e | sj,ej,ej |
|
||||||
|
|
||||||
@except
|
@except
|
||||||
|
|||||||
@ -939,6 +939,26 @@ Sol2ScriptingEnvironment::GetStringListFromFunction(const std::string &function_
|
|||||||
return strings;
|
return strings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
// string list can be defined either as a Set(see profiles/lua/set.lua) or as a Sequence (see
|
||||||
|
// profiles/lua/sequence.lua) `Set` is a table with keys that are actual values we are looking for
|
||||||
|
// and values that always `true`. `Sequence` is a table with keys that are indices and values that
|
||||||
|
// are actual values we are looking for.
|
||||||
|
|
||||||
|
std::string GetSetOrSequenceValue(const std::pair<sol::object, sol::object> &pair)
|
||||||
|
{
|
||||||
|
if (pair.second.is<std::string>())
|
||||||
|
{
|
||||||
|
return pair.second.as<std::string>();
|
||||||
|
}
|
||||||
|
BOOST_ASSERT(pair.first.is<std::string>());
|
||||||
|
return pair.first.as<std::string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
std::vector<std::string>
|
std::vector<std::string>
|
||||||
Sol2ScriptingEnvironment::GetStringListFromTable(const std::string &table_name)
|
Sol2ScriptingEnvironment::GetStringListFromTable(const std::string &table_name)
|
||||||
{
|
{
|
||||||
@ -954,7 +974,7 @@ Sol2ScriptingEnvironment::GetStringListFromTable(const std::string &table_name)
|
|||||||
{
|
{
|
||||||
for (auto &&pair : table)
|
for (auto &&pair : table)
|
||||||
{
|
{
|
||||||
strings.push_back(pair.second.as<std::string>());
|
strings.emplace_back(GetSetOrSequenceValue(pair));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strings;
|
return strings;
|
||||||
@ -989,7 +1009,7 @@ Sol2ScriptingEnvironment::GetStringListsFromTable(const std::string &table_name)
|
|||||||
std::vector<std::string> inner_vector;
|
std::vector<std::string> inner_vector;
|
||||||
for (const auto &inner_pair : inner_table)
|
for (const auto &inner_pair : inner_table)
|
||||||
{
|
{
|
||||||
inner_vector.push_back(inner_pair.first.as<std::string>());
|
inner_vector.emplace_back(GetSetOrSequenceValue(inner_pair));
|
||||||
}
|
}
|
||||||
string_lists.push_back(std::move(inner_vector));
|
string_lists.push_back(std::move(inner_vector));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user