View Single Post
04-06-20, 04:32 PM   #11
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Walkerbo View Post
I can see the do but how does it work outside of a function?
Think of your file as one large function. The do...end block creates a new scope. That allows everything in that scope to see everything before it and globals but nothing outside of it can see or modify it's locals.

In this case the variable profitCounter, the table sellList, and the function avkSellList cannot be seen by the rest of your code and also cannot be modified if you happen to accidentally reuse one of those variable names.

Originally Posted by Walkerbo View Post
Also the bleeding local's is due to the max limit of 200 local's used, so I am in the process of moving variables into tables to resolve this issue.
If you have too many locals then you are either doing something wrong or need to split your addon into multiple files.
  Reply With Quote