I'm trying to build a real simple spell selection set of macros for my players, but in trying to return a list of eligible spells depending on the Class & Level passed to a UDF, I keep running into the error msg in the subject line.
Here's the body of the UDF:
Code: Select all
[h: Level = arg(0)]
[h: Class = arg(1)]
[h: spells = getLibProperty("Spells", "Lib:Utility")]
[h, foreach (spell, spells): SpellList = if(json.get(spell, "SpellLevel") == Level && upper(json.get(spell, "SpellType")) == upper(Class) , json.append(SpellList, spell), SpellList)]
[h: macro.return = SpellList]
Entries in Spells property are bracketed and look like this:
Code: Select all
{"SpellSource":"bfrpg","Spell":"Detect Magic","SpellType":"cleric","SpellLevel":1}
I must be doing something wrong, but for the life of me, I can't figure out what it could be. The calls to Json.Get look right. Does anyone see where I've goofed on this?