Open main menu
Home
Random
Log in
Settings
About AddOn Studio
Disclaimers
AddOn Studio
Search
Editing
WoW:API wipe
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{wowapi}} '''Wipes''' a table of all contents. table = table.wipe(table) wipe(table) == Arguments == ; table : Table - The table to be cleared. == Returns == ; table : Table - The empty table. == Example == local tab = {} tab.Hello = "Goodbye" print(tab.Hello) -- print "Goodbye" tab = table.wipe(tab) print(tab.Hello) -- print nil == Notes == * 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} copy=data assert(copy==data) -- they're the same object copy={} assert(copy~=data) -- they're no longer the same: assert(#copy==0) -- the copy is expectedly empty, assert(#data==3) -- but the original table remains. copy2=data assert(copy2==data) -- they're the same object wipe(copy2) assert(copy2==data) -- they're still the same object: assert(#copy2==0) -- the copy is expectedly empty, assert(#data==0) -- and so is the original table.
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Apinav
(
edit
)
Template:Editlink
(
edit
)
Template:Tocright
(
edit
)
Template:Wowapi
(
edit
)