Premade Groups Filter

Premade Groups Filter

9M Downloads

Improper Value Breaks Filtering

doadin opened this issue ยท 1 comments

commented

if you ad "ur" for instance filtering instead of "tur" instead of just not matching it breaks filtering.

commented

This issue exists since I added the line setmetatable(env, { __index = function(table, key) return 0 end }), which initializes all values which are not set in the table to zero. I did this because I added keywords (dps|heal|tank)_(paladin|priest|...)s and also (paladin|priest|...)_(dps|heals|tanks). Because I add the keywords dynamically, not all of them are set for an entry, which would cause a semantic error almost every time. So I was lazy and let the env table return 0 for all non-existing values. That however completely stops any semantic errors from popping up, because now even quhfiwefb returns 0. Unfortunately, 0 evaluates to true in LUA, i.e. if 0 then print("yes") endprints in fact yes (although 0==true is false).

So the proper way to fix this is to initialize the role-class-keywords either manually or with a sophistocated method and remove that metatable method alltogether.