PDA

View Full Version : Examples for processing a comma (or other) separated list?



Varsuuk
January 4th, 2021, 05:03
I was able to fix an issue and move on to next area: adjusting rolls via onMod() while looking at class/race.

I'd like to make some decisions based on some "tags". I was picturing this as a comma (or anything if better recommendation) separated list of things like:
"ranged, magic, piercing". now, I know 5E and 2E both do something of this sort somewhere ;) I've run across it in the past (but it was over 5 months since last worked on this)

Since I am stopping for the night, I was hoping someone could off the top of their head say: "look in file XXXX of ruleset YYYYY - there are examples there." to let me hit the ground running tomorrow.

In case not obvious, my intent is to check tags like if it's ranged, I can apply a dex bonus if they have it. Right now, I am only doing from the SOURCE point of view, but late Ron TARGET, things like "magic" may have an effect as well.


Thanks all.

Trenloe
January 4th, 2021, 10:00
Do a search in files for StringManager.split

It's used all over the place - results in a LUA table, which you usually iterate through using for key, value in ipairs(split_table) do - but may use the table in other ways depending on what you're doing.

Varsuuk
January 4th, 2021, 21:36
Thanks, you rock - I knew I remember seeing this and probably using it in the past. Of course, StringManager, home to so much - will defamiliarize myself with it now.

superteddy57
January 4th, 2021, 21:37
Many of the API's and controls have hidden secrets. When in doubt CoreRPG tends to have the answer.