Gaming
 

MCom.stringVarToSetFunc

From WoWWiki

This article is a part of the documentation of the MCom function library

 --[[
   stringVarToSetFunc ( string varString )
     Returns a function that can be used to set the passed string
     to a value.  However this can parse complex variable names
     that contain . such as "Something.Variable"
     
     This is a lot like setStringVar.  However, setStringVar has to
     generate several objects that will need to be garbage
     collected.  The function returned by stringVarToSetFunc does
     not generate any amount of GCs worth worying about.  So if
     you are needing to do this very often, like OnUpdate, then
     it is best to use this function to convert to a function,
     and simply call that functin to set the data you need.      
     
     It does not handle "Something['Variable']".. Just use the .
     format instead.  This also works for number indexes.
   
   Args:
     varString - the variable to set, encapsulated in a string, ex:
     "Something.Variable.Monkey.Hippo"
  
   Returns:
     function ( number value) - a function that when called will
     set the string passed here, to  the value passed to the function.
 ]]--