Copy nodes to lua table
This commit is contained in:
parent
43b920bfb5
commit
a7a088d416
@ -259,7 +259,11 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
|||||||
"version",
|
"version",
|
||||||
&osmium::Way::version,
|
&osmium::Way::version,
|
||||||
"get_nodes",
|
"get_nodes",
|
||||||
[](const osmium::Way &way) { return sol::as_table(&way.nodes()); },
|
[&context](const osmium::Way &way) {
|
||||||
|
sol::table nodes(context.state, sol::create);
|
||||||
|
for(const osmium::NodeRef& nr : way.nodes()){ nodes.add(nr); }
|
||||||
|
return nodes;
|
||||||
|
},
|
||||||
"get_location_tag",
|
"get_location_tag",
|
||||||
[&context, &get_location_tag](const osmium::Way &way, const char *key) {
|
[&context, &get_location_tag](const osmium::Way &way, const char *key) {
|
||||||
// HEURISTIC: use a single node (last) of the way to localize the way
|
// HEURISTIC: use a single node (last) of the way to localize the way
|
||||||
|
Loading…
Reference in New Issue
Block a user