-
January 12th, 2018, 22:11 #1
removeEffect does not escape magic characters
removeEffect in manager_effect.lua does not escape magic characters
Code:function removeEffect(nodeCTEntry, sEffPatternToRemove) if not sEffPatternToRemove then return; end for _,nodeEffect in pairs(DB.getChildren(nodeCTEntry, "effects")) do if DB.getValue(nodeEffect, "label", ""):match(sEffPatternToRemove) then nodeEffect.delete(); return; end end end
Code:function removeEffect(nodeCTEntry, sEffPatternToRemove) if not sEffPatternToRemove then return; end for _,nodeEffect in pairs(DB.getChildren(nodeCTEntry, "effects")) do if DB.getValue(nodeEffect, "label", ""):match(escMagic(sEffPatternToRemove)) then nodeEffect.delete(); return; end end end --[[ Escape magic characters ]]-- function escMagic(str) if not str then return; end str = str:gsub('%(','%%('); str = str:gsub('%)','%%)'); str = str:gsub('%.','%%.'); str = str:gsub('%+','%%+'); str = str:gsub('%-','%%-'); str = str:gsub('%*','%%*'); str = str:gsub('%?','%%?'); str = str:gsub('%[','%%['); str = str:gsub('%^','%%^'); str = str:gsub('%$','%%$'); return str; end
Last edited by Ken L; January 12th, 2018 at 23:36.
-
January 13th, 2018, 08:20 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
Most effects added/removed often do not have any special characters, so I'm not surprised this hasn't been an issue. I can't think of any off the top of my head other than "Flat-footed" in the 3.5E ruleset.
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks