osm2pgsql-dev / osm2pgsql

OpenStreetMap data to PostgreSQL converter
https://osm2pgsql.org
GNU General Public License v2.0
1.48k stars 473 forks source link

Check that Lua functions on OSM object are called correctly #2240

Closed joto closed 2 weeks ago

joto commented 3 weeks ago

The code that deals with functions called on the Lua OSM object given as parameter to the process callbacks is somewhat strange. The result is that calling "object.as_point()" etc. will work, but the correct Lua way to do this is "object:as_point()". This adds a check to all the functions that detects this case and prints a warning. It will also check that those functions are not called with any additional arguments.

Checking for this now, users will hopefully fix this. This gives us the opportunity later to change or code to be more in line with usual Lua syntax.

This will only print a warning once per function.