I use limejs and I declare a function like:
function up(){
var pos = global.getPosition();
pos.x += 2;
global.setPosition(pos);
}
and call it using
lime.scheduleManager.schedule(up,global);
How do I get rid of the global variable?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since second parameter to
scheduleis context object and you passglobalto it, you could write the function asIf that is really what you’re asking for.
If you only need to delete the variable, you can set it to null. Operator
deleteis intended for deleting object properties, not unsetting variables.