Tables - count items in them
View Single Post
08-02-16, 02:29 AM
Join Date: Mar 2006
Originally Posted by
You should also define the table
outside the function. Right now you are (re)creating the table every time the function runs, which is terribad.
For a testing/debugging function, there's nothing wrong with recreating the table every time the function runs.
For production functions, it depends on the purpose of the table, and the frequency with which the function will be run. If it's an OnUpdate script, or running in response to UNIT_AURA events, yes, creating a new table on each run is a big no-no. If it's running in response to a user entering a slash command, or an infrequent event like PLAYER_ENTERING_WORLD, it's not really a big deal, and you should do whatever makes more sense scope-wise for the content/purpose of the table.
Retired author of
too many addons
Message me if you're interested in taking over one of my addons.
message me about addon bugs or programming questions.
View Public Profile
Send a private message to Phanx
Find More Posts by Phanx