String.match return multiple text even if not all exist
Folks,
Never liked regex but I used it, though Lua doesn't use regex, it uses pattern matching
Inside Traveller when you drop a skill onto an existing skill it increases that Skill by 1.
But specialised skills don't work.
For example:
Melee (unarmed) 1, Carouse 2
I have it making Carouse 3 if Carouse is dragged over the NPC skills, using
Code:
sSkill, nExistingLevel = string.match(sSkillsCurrently, "(" .. sNewSkill .. ") (%d*)");
But what I want is for it to also now return the specialism if it exists, just can't seem to get it to work
Code:
sSkill, sSpecialism, nExistingLevel = string.match(sSkillsCurrently, "(" .. sNewSkill .. ") (%s+) (%d*)");
Returns nothing but nils.
Cheers,
MBM