GetValue() public méthode

public GetValue ( object key ) : ScriptObject
key object
Résultat ScriptObject
Exemple #1
0
 public ScriptValue GetValue(string key)
 {
     if (valueType == scriptValueType)
     {
         return(scriptValue.GetValue(key));
     }
     throw new ExecutionException($"类型[{ValueTypeName}]不支持获取变量 String : [{key}]");
 }
        public override ScriptObject GetValue(object key)
        {
            if (this.metaTable == null)
            {
                return(m_listObject.ContainsKey(key) ? m_listObject[key] : m_Script.Null);
            }
            else
            {
                if (m_listObject.ContainsKey(key))
                {
                    return(m_listObject[key]);
                }

                ScriptObject idx_obj = this.metaTable.GetValue(ScorpioMetaMethod.INDEX);
                if (idx_obj == null)
                {
                    return(m_Script.Null);
                }

                if (idx_obj.IsFunction)
                {
                    ScriptObject[] paramsArr = { this, m_Script.CreateObject(key) };
                    return(m_Script.CreateObject(idx_obj.Call(paramsArr)));
                }
                else if (idx_obj.IsTable)
                {
                    return(idx_obj.GetValue(key));
                }
                else
                {
                    return(m_Script.Null);
                }
            }
        }