The Aaron said: if you look up in the code a bit, you can see that it is a variable passed into the function: const addCommonEquipmentItems = () => {
getSetItems('addCommonEquipmentItems', {
process: ( data ) => {
const commonEquipment = [
{
The shaped sheet is very complex, and gets constructed out of many libraries of operations. getSetItems() in the above, calls getSetData(), passing it a collectionArray which is [] (empty array) as the object passed to getSetItems() doesn't define a property for collectionArrayRepeatingSections. getSetData() passes that empty array to getAttrs(), and the result of that call is then passed to the process function defined above. The practical upshot of all this is that data is an empty object created in a higher scope and passed down to the process function for collection of changes. Since objects are passed by reference in javascript, the changes made to data in the process() function are visible in the object in the calling scope, which is then passed to setData(), which does some optimizations around not setting anything that hasn't changed, eventually calling setAttrs() to push the changes up to Roll20. After that completes, it calls the processCallback() defined in the above object as a sibling of the process() function, which just calls updateEquipment() to make sure all the weights and such are updated correctly. Hope that helps! Yes, I followed it all up to where the data object is first passed in. I just don't understand enough to get that object myself in order to make the changes/updates I need to do. I know I can't use "data" without a reference, I just don't know how to make that reference. How do I do this pseudo code: var myDataObj = selectedCharacter.shapedCharacterSheetObj; myDataObj.repeating_equipment[new] = myNewEquipmentItem; As a side note (because that's where this script is going), is there a way to call that updateEquipment function from within my code without writing my own? I feel like I've hit the ceiling of what I'm capable of with this thing, but I really want this to work!