I have a simple question:
If I have a script along the lines of this
If mouseClicked(or something) then
Will that affect my performance?
In other words, will running a touched event in a function for every action stack over time and harm performance?
If it does harm my performance, will disconnecting it help? Or if not is there any other way?
Like everything else in the world, too much can be bad, i.e. having an excessive amount of touched events which can be replaced by other systems. Another issue you’ll see though is the lack of organisation, and if you want to make a simple change you’ll have to sift through hundreds of scripts.
I would just like to say though that for your code, you shouldn’t be putting the Touched event within the function, and instead putting the function inside the Touched event, as such:
Thanks for the reply. I am aware of that fact. However, my circumstances require that I put the event inside the function(I am making an ability system, including animated abilities. Each ability is sorted into a function in a list.) My main question still remains: Say I were to have a while loop constantly adding 10 touched events per second. Will the touched events stack and wreck the performance, or is Lua smart enough to replace it?