Add api_version gloabal variable to profiles

Currently only `0` is supported (the default).
This commit is contained in:
Patrick Niklaus
2016-12-01 22:10:56 +00:00
committed by Patrick Niklaus
parent b9b52cb857
commit 0f3a463854
9 changed files with 29 additions and 0 deletions
@@ -306,6 +306,20 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
context.has_node_function = node_function.valid();
context.has_way_function = way_function.valid();
context.has_segment_function = segment_function.valid();
auto maybe_version = context.state.get<sol::optional<int>>("api_version");
if (maybe_version)
{
context.api_version = *maybe_version;
}
if (context.api_version < SUPPORTED_MIN_API_VERSION ||
context.api_version > SUPPORTED_MAX_API_VERSION )
{
throw util::exception("Invalid profile API version " + std::to_string(context.api_version) +
" only versions from " + std::to_string(SUPPORTED_MIN_API_VERSION) +
" to " + std::to_string(SUPPORTED_MAX_API_VERSION) +
" are supported." + SOURCE_REF);
}
}
const ProfileProperties &Sol2ScriptingEnvironment::GetProfileProperties()