WoW:API collectgarbage: Difference between revisions

Specify default arg action
No edit summary
(Specify default arg action)
Line 2: Line 2:
Control the garbage collector and query it for information. As of WoW 2.0, this is the same as the standard collectgarbage() in Lua, but prior to that it was quite different.
Control the garbage collector and query it for information. As of WoW 2.0, this is the same as the standard collectgarbage() in Lua, but prior to that it was quite different.


  collectgarbage(opt [, arg])
  collectgarbage([opt [, arg]])


== Parameters ==
== Parameters ==
=== Arguments ===
=== Arguments ===
:(opt [, arg])
:([opt [, arg]])


:;opt: String - This function is a generic interface to the garbage collector. It performs different functions according to its first argument:
:;opt: String - This function is a generic interface to the garbage collector. It performs different functions according to its first argument:
Line 12: Line 12:
::    * "stop": stops the garbage collector.
::    * "stop": stops the garbage collector.
::    * "restart": restarts the garbage collector.
::    * "restart": restarts the garbage collector.
::    * "collect": performs a full garbage-collection cycle.
::    * "collect": performs a full garbage-collection cycle.  This is the default action if '''opt''' is not specified.
::    * "count": returns the total memory in use by Lua (in Kbytes).
::    * "count": returns the total memory in use by Lua (in Kbytes).
::    * "step": performs a garbage-collection step. The step "size" is controlled by arg (larger values mean more steps) in a non-specified way. If you want to control the step size you must experimentally tune the value of arg. Returns true if the step finished a collection cycle.
::    * "step": performs a garbage-collection step. The step "size" is controlled by arg (larger values mean more steps) in a non-specified way. If you want to control the step size you must experimentally tune the value of arg. Returns true if the step finished a collection cycle.
Anonymous user