Jump to content

Search the Community

Showing results for tags 'locals'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 1 result

  1. Hi, I was curious when the garbage collector would clean something like this: function testFunction () local testVariable = 100 local function firstFunctionInBlock () print("first function, testVariable: " .. testVariable ) testVariable = testVariable + 1 end local function secondFunctionInBlock () print("second function, testVariable: " .. testVariable) testVariable = testVariable + 1 end return function () firstFunctionInBlock() secondFunctionInBlock () end end function testFunction () -------------------------- -- function block -- -------------------------- end Executed with: local newCreatedFunction = testFunction() newCreatedFunction() newCreatedFunction() newCreatedFunction() -- print("--") -- local newCreatedFunction2 = testFunction() newCreatedFunction2() newCreatedFunction2() newCreatedFunction2() Results: first function, testVariable: 100 second function, testVariable: 101 first function, testVariable: 102 second function, testVariable: 103 first function, testVariable: 104 second function, testVariable: 105 -- first function, testVariable: 100 second function, testVariable: 101 first function, testVariable: 102 second function, testVariable: 103 first function, testVariable: 104 second function, testVariable: 105 I assume when I nil the function that is active in the block. newCreatedFunction = nil It will clear the first created function block by the garbage collector. newCreatedFunction2 = nil Same goes for clearing the second created function block. I did like to hear your opinion about this matter!
×
×
  • Create New...