Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-02-2017, 10:30 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko has a spectacular aura aboutKirko has a spectacular aura about
Anonymous functions don't delete

I noticed that these functions don't delete and are stored until I clearVars. Is this normal or should I be doing something to clear them? I tried to destroy the function after I use it but that didn't work.

PHP Code:
function onCreated() {
  
//this.clearVars(); // Will clear it

  
temp.fn = function(result) {
    
printf("Test: %d"result);
  };
  
test(55fn);

  
temp.fn.destroy();  // Function function_2107071_1.destroy not found at line 9

  
echo("Errors: " this.scriptErrors);
  echo(
"Useless crap: " getStringKeys("this.function").size()); // Goes up everyime script is updated
}


function 
test(abcallback) {
  (@ 
callback)(b);

Reply With Quote
  #2  
Old 01-03-2017, 12:47 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
The "not found" error kindof makes sense as the variable is not an object. I don't believe there is another solution to clearing these anonymous functions however .
Reply With Quote
  #3  
Old 01-03-2017, 05:20 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Kirko View Post
I noticed that these functions don't delete and are stored until I clearVars. Is this normal
Certainly isn't.
Quote:
Originally Posted by Kirko View Post
or should I be doing something to clear them?
Nope. They should be cleaned up automatically by the garbage collector when leaving scope. This looks like a bug in the script engine.
__________________
Skyld
Reply With Quote
  #4  
Old 01-07-2017, 03:49 AM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko has a spectacular aura aboutKirko has a spectacular aura about
Is there anyone that can actually fix or is the bug here to stay
Reply With Quote
  #5  
Old 01-07-2017, 06:28 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
try temp.fn = "";
__________________
Quote:
Reply With Quote
  #6  
Old 01-07-2017, 06:22 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko has a spectacular aura aboutKirko has a spectacular aura about
That didn't seem to work either
Reply With Quote
  #7  
Old 01-07-2017, 06:27 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
Quote:
Originally Posted by fowlplay4 View Post
try temp.fn = "";
perhaps temp.fp = "4";

ill show myself out
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:58 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.