function addFeedback(actorsTable,actor,target,action,fx) local bFoundActor = false local bFoundTarget = false local bFoundAction = false for i,actorElem in pairs(actorsTable) do if actorElem.KEY == actor then bFoundActor = true local targetList = actorElem.Target.targets for j,targetElem in pairs(targetList) do if targetElem.KEY == target then bFoundTarget = true local actionList = targetElem.Action.actions for k,actionElem in pairs(actionList) do if actionElem.KEY == action then bFoundAction = true break --do nothing as action already exists end end if bFoundAction == false then local newAction = {{KEY=action,FXControl=fx}} appendTable(actionList,newAction) end break end end if bFoundTarget == false then local newTarget = {{KEY=target,Action={actions={{KEY=action,FXControl=fx}}}}} appendTable(targetList,newTarget) end end end if bFoundActor == false then local newActor = {{KEY=actor, Target={targets={{KEY=target,Action={actions={{KEY=action,FXControl=fx}}}}}}}} appendTable(actorsTable,newActor) end end function addFeedbackArchetype(actor,target,action,fx) addFeedback(params.FeedbackFxManager_Template.actors,actor,target,action,fx) end