joto / osmium

C++/Javascript framework for working with OSM files.
http://wiki.openstreetmap.org/wiki/Osmium
GNU General Public License v3.0
123 stars 31 forks source link

Global scope #84

Closed sabas closed 11 years ago

sabas commented 11 years ago

If I write a callback in a separate file and make there use of a global variable in the main file the callback seems to use the variable as a local function. Example:

var cnode=0;
include("nodes.inc.js");
    Osmium.Callbacks.node= nodes()

nodes.inc.js

function nodes() {
    cnode++;
}
joto commented 11 years ago

If you do Osmium.Callbacks.node= nodes() you are calling the nodes function and putting its return value in Osmium.Callbacks.node instead of putting the function in there. Osmium.Callbacks.node=nodes should work.

sabas commented 11 years ago

Thanks!