kalzme
Member
Hey,
In javascript I could write something like this:
where the callback parameter that is passed to the first function will also exist in the wrappedCallback function defined inside of that function.
However, whenever I try to do something like this in Game Maker, it crashes saying it can't find the callback variable.
I imagine this has to do with the way Game Maker scopes variables, but is there any way around this?
In javascript I could write something like this:
JavaScript:
function test(callback) {
var wrappedCallback = function() {
alert("WRAPPER");
if (callback != null) {
callback();
}
}
wrappedCallback();
}
test(function() {
alert("CALLBACK");
});
However, whenever I try to do something like this in Game Maker, it crashes saying it can't find the callback variable.
I imagine this has to do with the way Game Maker scopes variables, but is there any way around this?