TryGetVariable() public method

public TryGetVariable ( string varName, object &val ) : bool
varName string
val object
return bool
        public void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
        {
            string name = m_VariableName;

            if (!string.IsNullOrEmpty(name))
            {
                m_HaveValue = instance.TryGetVariable(name, out m_Value);
            }
            else
            {
                m_Value.SetNullObject();
                m_HaveValue = true;
            }
        }
Esempio n. 2
0
 public void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
 {
     if (IsConst)
     {
         return;
     }
     if (m_ArgIndex >= 0 && m_ArgIndex < args.Count)
     {
         m_Value     = args[m_ArgIndex];
         m_HaveValue = true;
     }
     else if (m_ArgIndex == c_Iterator)
     {
         m_Value     = iterator;
         m_HaveValue = true;
     }
     else if (null != m_Proxy)
     {
         m_Proxy.Evaluate(instance, handler, iterator, args);
         if (m_Proxy.HaveValue)
         {
             m_Value     = m_Proxy.Value;
             m_HaveValue = true;
         }
         else
         {
             m_HaveValue = false;
         }
     }
     else
     {
         string name = string.Empty;
         if (null != m_LocalName)
         {
             name = m_LocalName;
         }
         else if (null != m_GlobalName)
         {
             name = m_GlobalName;
         }
         else if (null != m_StackName)
         {
             name = m_StackName;
         }
         if (!string.IsNullOrEmpty(name))
         {
             m_HaveValue = instance.TryGetVariable(name, out m_Value);
         }
     }
 }
 static public int TryGetVariable(IntPtr l)
 {
     try {
         StorySystem.StoryInstance self = (StorySystem.StoryInstance)checkSelf(l);
         System.String             a1;
         checkType(l, 2, out a1);
         System.Object a2;
         var           ret = self.TryGetVariable(a1, out a2);
         pushValue(l, true);
         pushValue(l, ret);
         pushValue(l, a2);
         return(3);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }