Originally Posted by Baertram
I hoped so @interesting
Thx man! I hope it is not any small bug or typo which causes this issue...
Every help is very appreciated!
Even small findings can improve the overall performance
If I understand you right:
If any of the registered filters for the current filterType (e.g. LAF_BANK) returns false the other filters shouldn't be executed/needed anymore, because the item will be hidden.
So one could abort the for ... do loop already in between?
|
Yes, since your always doing:
Lua Code:
result = result and <something else>
if result is already false, its always going to return false, regardless of what <something else> is.
Someone please correct me if I'm misunderstanding this part, but isn't the if statement unnecessary?
Lua Code:
for _,v in pairs(filters[filterType]) do
if(v) then
result = result and v(slot)
end
end
Doesn't v just represent functions in the table that tell if something should be displayed or not...
since v is not a boolean (correct?) then wont the: if(v) always return true. If v did not exist it never would have made it to that part of the code, it would have broken out of the for loop before that.
So then couldn't he just do:
Lua Code:
for _,v in pairs(filters[filterType]) do
result = result and v(slot)
if result == false then
return result
end
end