Skip to content

Commit a7a088d

Browse files
committed
Copy nodes to lua table
1 parent 43b920b commit a7a088d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/extractor/scripting_environment_lua.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
259259
"version",
260260
&osmium::Way::version,
261261
"get_nodes",
262-
[](const osmium::Way &way) { return sol::as_table(&way.nodes()); },
262+
[&context](const osmium::Way &way) {
263+
sol::table nodes(context.state, sol::create);
264+
for(const osmium::NodeRef& nr : way.nodes()){ nodes.add(nr); }
265+
return nodes;
266+
},
263267
"get_location_tag",
264268
[&context, &get_location_tag](const osmium::Way &way, const char *key) {
265269
// HEURISTIC: use a single node (last) of the way to localize the way

0 commit comments

Comments
 (0)