Search and Replace Value on a Table (LUA)
-
Please help me on this task. I have this table in .LUA extension
tbl = { [500] = { unidentifiedDisplayName = "Choco Gangjeong", unidentifiedResourceName = "금광석", unidentifiedDescriptionName = { "" }, identifiedDisplayName = "Choco Gangjeong", identifiedResourceName = "금광석", identifiedDescriptionName = { "A snack of a piece of walnut mixed with chocolate and rounded together.", "I don't know why walnut carries it.", "________________________", "Heals 10% HP and 10% SP.", "________________________", "^ff0000(The item is deleted after the event ends.)^000000", "________________________", "^0000CCWeight:^000000 1" }, slotCount = 0, ClassNum = 0 }, [5453] = { unidentifiedDisplayName = "Unidentified Helmet", unidentifiedResourceName = "헬름", unidentifiedDescriptionName = { "Can be identified by using a ^990099Magnifier^000000." }, identifiedDisplayName = "Copper Dragon Helm", identifiedResourceName = "용투구_동", identifiedDescriptionName = { "A legendary helm, inspired by god of Dragon.", "________________________", "Decreases damage taken from ^FF0000Demi-Human^000000 race monsters by 5%.", "________________________", "Increases Physical Damage against ^FF0000Demi-Human^000000 race monsters by 1%.", "________________________", "^0000CCType:^000000 Headgear", "^0000CCDefense:^000000 5", "^0000CCPosition:^000000 Upper", "^0000CCWeight:^000000 150", "^0000CCArmor Level:^000000 1", "^0000CCRefineable:^000000 No", "________________________", "^0000CCRequirement:^000000 None" }, slotCount = 1, ClassNum = 454 }, [1230000] = { unidentifiedDisplayName = "IDTest Ammo", unidentifiedResourceName = "자르곤", unidentifiedDescriptionName = { "" }, identifiedDisplayName = "IDTest ammo", identifiedResourceName = "자르곤", identifiedDescriptionName = { "When equipped with ^990099IDTest Gun^000000:", "DEX +1", "________________________", "^0000CCType:^000000 Ammo", "^0000CCAttack:^000000 10", "^0000CCWeight:^000000 1", "^0000CCElement:^777777 Neutral" }, slotCount = 0, ClassNum = 0 }, }
What I need to do is search for this 2 value in a table ():
Armor Level
slotCountIf the table {} has “Armor Level” then replace “slotCount = 2”
slotCount in the table has a value varying from to 0-4Thank you…
-
I presume that you want to do this within the
[
digits] = {
…}
groupings? -
Hello, @mark-lozada, @alan-kilborn and All,
A basic regex solution could be :
SEARCH
(?s-i)(Armor Level.*?\},\s+slotCount =) [0-4]
REPLACE
\1 2
As usual, tick the
Wrap around
option and select theRegular expression
search modeNote : If this syntax is not restrictive enough, try that one :
SEARCH
(?s-i)(\^0000CCArmor Level.*?\},\s+slotCount =) [0-4]
REPLACE
\1 2
Best Regards,
guy038
-
Thank you very much! It worked wonderful
Thank you for your time!