WoW:API wipe: Difference between revisions

215 bytes added ,  16 October 2009
m
(Example first since it's simpler, lays foundation for concepts in Notes)
Line 19: Line 19:


== Notes ==
== Notes ==
The difference between ''wipe(table)'' and ''table={}'' is that ''wipe'' removes the contents of the table, but retains the variable's internal pointer.
* While this function returns an empty table, it is not necessary to assign it to a variable.
 
local t = {"stuff"}
t = wipe(t)
print(#t) -- prints 0
local t = {"stuff"}
wipe(t)
print(#t) -- also prints 0
 
* The difference between ''wipe(table)'' and ''table={}'' is that ''wipe'' removes the contents of the table, but retains the variable's internal pointer.


  data={1,2,3}
  data={1,2,3}
Anonymous user