SA-MP Forums Archive
How does dynamic variables work? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How does dynamic variables work? (/showthread.php?tid=512186)



How does dynamic variables work? - Xtreme Brotherz - 09.05.2014

Hey Guys,

Is there a need to delete a dynamic variable created or it does it automatically?

Код:
new variable;
but we are not able to

Код:
delete variable;
Is there any way to do this?

Wont this affect the memory usage of the script?



Thanks


Re: How does dynamic variables work? - Dignity - 09.05.2014

I think you can ''remove'' variables by using them only inside a callback (basically preventing preempetive usage)

pawn Код:
function()
{
    new variable;
    // etc

    return 1;
}



AW: How does dynamic variables work? - Nero_3D - 09.05.2014

There is no dynamic memory in pawn although it uses the same keyword 'new'
The new keyword creates a 32 bit variable / array indifferent of the type

Read the pawn-lang.pdf for further documentation


Re: How does dynamic variables work? - Xtreme Brotherz - 09.05.2014

Ohh! Thanks for that!


Re: How does dynamic variables work? - RajatPawar - 09.05.2014

Quote:
Originally Posted by Xtreme Brotherz
Посмотреть сообщение
Ohh! Thanks for that!
It might be worth mentioning that this plugin has added support to access memory dynamically. You can look into that, if interested.

Cheers